exe4j the jar package into exe

Transfer: https: //blog.csdn.net/weixin_42769504/article/details/93760511

Transfer: https: //blog.csdn.net/q1285067278/article/details/81505327

1.exe4j software packages turn the jar to exe file

(1) Open exe4j, project type option to select "JAR" in "EXE" mode. As shown in Figure 4.

 

(2) Application info, application name input and output paths. 5 shown in FIG.

 

 . (3) Executable info Executable name: the name of the exe provided, as shown in FIG.

 

 32-bit or 64-bit. I jre environment 64 so select Generate 64-bit executable, as shown in FIG.

 

 (4) Java invocation. Select the path jar add in, click on the "+" to add. Select Main class that is the main class that void main class. I jar package path with JRE, JDK environment copied together, so see jar package export path with the path of the eclipse is not the same, as shown in FIG.

 

 (5) JRE minimum and maximum version is set. My jre version 1.8. 9 shown in FIG.

 

 

Click on the left of the Search sequence, because my program is going to install on your computer is not installed jre environment so that the environment variable jre path search is not custom, I deleted the default path inside Serach sequence, add my jre relative path, this is very important, be sure to use a relative path, or can not be found will be reported operating environment. A relative path. \ JRE, as shown in FIG. I copy the exe to generate jre with the same folder, so use. \ Represents the current directory.

 

 Then all the way next automatically compile packed up. Path is the path we originally set can be found 3.exe, shown in Figure 11.

 

 

3, Inno Setup software packaged exe and jre environment

因为我们要安装到没有安装jre环境的电脑,所以还需打包jre环境。采用inno setup进行打包。打包前,我先把生成的3.exe和电脑安装的jre、jdk路径拷贝到同一个目录,如图12所示,因为我们刚才生成的exe文件需要跟jre文件夹同一个目录才能运行成功,不然找不到运行环境,会报找不到运行环境出错的。

 

 (1)打开inno setup脚本,新建脚本,如图13所示。点击下一步

 

 设置应用程序信息,如图14所示。我直接采用默认的,点击下一步。

 

 继续下一步,再下一步出现图15界面。添加exe路径,和jre环境,如图16所示。

 

 

 

 接下来下一步,一路到底,完成如图17所示。

 

 点击完成后,提示是否立即编译,选择是。选择路径保存脚本路径。如图18所示。

 

 直接自动编译,编译完成,就看到settup.exe了。如图19所示,完成。

 

Guess you like

Origin www.cnblogs.com/tv151579/p/12293642.html