Java implementation of installable exe program examples

Java implementation of installable exe program examples

The general idea of realizing installable exe files by writing java code:

1. Create a java project in eclipse, then write java code and export the written java project to a Jar package in jar format;

2. By installing exe4j software, the exported Jar format files are made into Executable file in exe format (Note: the. EXE file at this time can only be executed and cannot be installed);

3. By installing inno setup software, the executable Exe format file Jar format files and other required files are made into an installable Exe format file;

4. Note: the paths selected in exe4j and inno setup software are relative paths. Therefore, it is strongly recommended to keep operating and outputting files in one folder during the execution of exported jar package, exe4j, inno setup and other software;

The general steps to realize the installable exe format file through Java code are as follows:

1、 Create a java project, write the Java code, and export the jar package:

1. Create a java project and write java code, needless to say;

2. Export jar package:

Step 1:

Step 2:

Step 3:

2、 By installing exe4j software, make the jar package into an executable exe format file (Note: the EXE format file at this time can only be executed, but cannot be installed):

1. Download exe4j software and install it according to normal:

2. Step 1:

3. Step 2:

4. Step 3: when selecting the path, be sure to select the path of the folder where the jar package, JRE and other files are stored, which is also the output Exe format file path, it is strongly recommended to write this;

5. Step 4: fill in this position Exe format file output file name;

6. Step 5: add the jar package exported by the project. Note: the jar package path must be relative to the path at this time, because the above output is selected The path of exe format file is the path of the folder where the jar package is located, that is, exe4j software workspace is the path where the jar package is located, and the relative path is relative to the workspace. Because the jar package is located in the root directory of the workspace, you can only write the file name + format of the jar package;

7. Step 6: select the first Java class to execute when executing a project, which is similar to setting the access home page when accessing a project in BS project;

8. Step 7: after setting the jar package of the project and the first class of project access, go directly to the next step;

9. Step 8: made with exe4j Exe format files are 32-bit operating system files by default. If you want to create 64 bit operating system files, you can select and set them according to the following figure;

10. Step 9: set the version range of JRE when the program runs;

11. Step 10: because you are creating a java project, the project will eventually run on the JVM. If you want to install the JDK yourself, it is very inconvenient to configure the environment variables. Therefore, you can encapsulate the JRE in the production process, and you can set the version of the running environment JRE yourself to make it easier for users to use the program, The following figure shows the steps to set the JRE running environment for the program: pay special attention: JRE should be placed in the directory at the same level as the jar package, so that the relative directory can be written, otherwise files are easy to appear;

12. Step 11: default to next in the future:

3、 By installing inno setup software, the executable Exe file, jar file and JRE file are encapsulated into an installable Exe file:

1. Install the inno setup software and start it:

2. The default is next:

3. Set the installation folder created by default during program installation and the version number of the program:

4. The default is next:

5. Select the executable Directory of exe format files:

6. Will be executable Add the folder where the EXE file, jar package and JRE file are located, and add all the files in the folder, so that you can set it as a relative path:

7. The default is next:

8. Yes Create 1. EXE file, jar package and JRE file in the folder txt、2. txt、3. Txt three text files and set them in sequence as shown in the figure below. I don't know the specific reason. It may be to store some information during operation:

9. The default is next:

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

11. Directly default to next, and follow the steps in the picture:

12. After the production, you can see what can be installed now Exe format file:

13. Finally, the jar package, JRE file, executable Exe file, installable The folder where exe files are located is compressed into a package, and the package can be sent to the user. Users only need to unzip the file and click the installable Exe file, which can be installed. After installation, the unzipped file can be deleted;

If you have any questions, please leave a message or go to the community of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>