windows下jar包转成exe执行文件

1.安装软件

先去官网下载exe4j软件,这个软件可以把jar转成exe

地址:(https://exe4j.apponic.com/)

2.跟着步骤一步一步来就行了

image-20210328132009270

image-20210328132029482

image-20210328132129389

image-20210328133153025

设置打包后的程序兼容32和64位系统

image-20210328132317966

image-20210328132338350

image-20210328132353789

设置需要转换的jar包

image-20210328132433502

image-20210328132510820

设置main class

image-20210328132544116

因为我这里是普通java项目,直接选中就行了·

image-20210328132620651

image-20210328132636947

设置jre最小版本

image-20210328132721170

image-20210328132744965

image-20210328132827079

image-20210328132843302

image-20210328132928382

image-20210328132937107

image-20210328132950180

这时候我桌面上就生成了一个exe文件。

image-20210328133013867

双击执行,桌面上就出现了控制台运行的程序

image-20210328133225914

注意了:这里生成的exe文件必须要在含有jre的环境机器上才能运行。

那么如何在无jre环境机器上执行该exe,这里需要另一个工具inno setup,通过该工具,可以将jre和exe一起再打包安装,这样再没有jre电脑上也能运行,这里我就不演示了,因为我电脑上有jre。

inno setup官网:https://jrsoftware.org/isinfo.php

原文地址:https://www.cnblogs.com/wwjj4811/p/14588446.html