Java implementation of installable EXE programs

Source: Internet
Author: User

Java implementation of installable EXE programs

The general idea of implementing an installable EXE file by writing Java code:

1. Create a Java project in eclipse, then write Java code to export a well-written Java project to a. jar format jar package;

2, by installing the EXE4J software, the exported. jar format files are made into an. exe format executable file, (note: the. exe file can only be executed at this time, and cannot be installed);

3. By installing the Inno setup software, the executable. exe format files,. jar format files, and other required files are made into an installable. exe format file;

4, very note: in exe4j and inno Setup software selected path is a relative path, so in the exported jar package, exe4j, Inno Setup and other software implementation process, it is strongly recommended to keep in a folder to operate and output files;

The general steps for implementing an installable EXE format file through Java code are as follows:

First, create Java project, write good Java code, export jar package:

1, to create a Java project, write Java code will not have to say more;

2. Export the jar package:

Step One:

Step Two:

Step Three:

Second, through the installation of exe4j software, the jar package into executable exe format file (note: exe format file at this time can only be executed, but can not be installed):

1, download exe4j software, and then follow the normal installation can:

2. Step One:

3. Step Two:

4, step three: Pay attention to choose the path when you must choose to store a jar package, JRE and other files folder where the path, this is the output. exe format file path, it is strongly recommended to write;

5, step four: The content of this location is the file name of the. exe format files output;

6, Step five: Add the project exported jar package, very note: at this time the jar package path must be relative to the path , Because the path of the selected output. exe format file above is the path to the folder where the jar package resides, the EXE4J software workspace is the path where the jar package is located, relative to the workspace, because the jar package is in the root directory of the workspace, so only the file name of the jar package is written + Format can be;

7, Step Six: Select the execution of the project, the first implementation of the Java class, similar to the BS project, access to a project when set access to the first page;

8, Step seven: Project jar package and project access to the first class set, directly next next;

9, step eight: Using the exe4j. exe format file is the default 32-bit operating system files, if you want to make 64-bit operating system files, you can follow the selection settings;

10. Step Nine: Set the version range of the JRE when the program runs;

11, step ten: Because the creation of a Java project, the project is ultimately to run on the JVM, if you want to install the JDK users themselves, the configuration environment variables is very inconvenient, so you can make the process of the JRE package, you can set up a running environment JRE version, To make the user more convenient to use the program, is to set the JRE runtime environment steps: Very note: The JRE should be placed in the same directory as the jar package, so that the relative directory can be written, otherwise easy to appear files ;

12, Step 11: After the direct default next can:

To encapsulate executable. exe files, jar files, and JRE files into an. exe file that can be installed by installing the Inno Setup software:

1. Install Inno setup software and start the software:

2, the default next can:

3. Set the installation folder that is created by default when the program is installed and the version number of the program, and other information:

4, the default next can:

5. Select the directory for the executable. exe format file:

6. Add the executable folder of the. exe file, jar package, and JRE file, and add all the files in the folder so that it can be set as a relative path:

7, the default next can:

8. Create 1.txt, 2.txt, 3.txt three text files in the same folder as the. exe file, jar package, and JRE file, and follow the settings, and I don't know why, maybe to store some information in the running process:

9, the default next can:

10. Set the location of the output installable. exe format file and the file name in the output. exe format, very note: The output location of the installable. exe format file must also be the folder where the jar package, JRE file, executable. exe file resides .

11, direct default Next, follow the steps in the picture can be:

12, finished, you can now look at the installation of the. exe format file:

13, finally, the jar package, JRE files, executable. exe files, installable. exe files, and the like folder are compressed into a package, the package is sent to the user. Users only need to unzip the file, click on the installable. exe file, install it, after the installation can delete the extracted files;

Java implementation of installable EXE programs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.