如何从我的 java 项目生成 exe 文件?我应该使用哪个工具?
有人要求我制作一个程序(用java),但我被困住了,因为我不知道如何从我的jar文件生成exe文件......如果我为他们安装jdk环境,那将是无用的这个人不会如何编程...有谁知道如何做到这一点或者我应该使用什么工具?
来自阿根廷科尔多瓦首都的问候...提前致谢!
I was asked to make a program (in java) by some person but I was stacked as I didn't know how to generate and exe file from my jar file... It would be useless If I install for them the jdk environment as this person don't how to program... Does anyone knows ho to do this or what tool should I use ?
Regards from Córdoba Capital, Argentina...Thanks in advance !!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用 launch4J,它的使用和配置非常简单。
You could use launch4J, it's pretty simple to use and to configure.
阅读这篇文章,可能会有所帮助
http: //viralpatel.net/blogs/2009/02/convert-jar-to-exe-executable-jar-file-to-exe-converting.html
问候
托马斯
Read this post, it may help
http://viralpatel.net/blogs/2009/02/convert-jar-to-exe-executable-jar-file-to-exe-converting.html
Regards
Thomas
这是之前的一篇文章,其中有一些其他选项:
如何创建 Java 应用程序单击即可运行?
正如 Lucas 上面提到的,您需要在用户的计算机上安装 JRE 才能使 Java 应用程序正常运行。如果它是一个小程序,您可以考虑制作一个.bat文件(或*nux上的.sh文件)以允许用户运行该程序。您的 bat 文件可以像下面的文件一样简单。只需放入 .bat 文件并添加为快捷方式即可。我知道有更优雅的解决方案,但这很简单并且应该可行。
Here is a post from earlier that has some other options:
How to create a Java application which can be run by a click?
As Lucas mentions above, you will need to install the JRE on the user's machine to get a Java app to run properly. If it is a small program, you could consider making a .bat file (or .sh file on *nux) to allow the user to run the program. Your bat file could as simple as the one below. Just put in a .bat file and add as a short cut. I know there are more elegant solutions out there, but this is simple and should work.
他们不需要安装整个 JDK 来运行 jar 文件,他们所需要的只是明显较小的 JRE。这是分发 Java 应用程序时的标准做法。
与生成本机二进制文件相比,在 jvm 上运行 java 程序的一大优点是,假设您没有使用依赖于平台的库,它会立即独立于平台。
They don't need to install the entire JDK to run the jar file, all they need is the significantly smaller JRE. This is standard practice when distributing java applications.
A big advantage of running your java program on the jvm as compared to generating a native binary is that it will, assuming you aren't using a platform-dependent library, be platform-independent straight away.
您可以使用Excelsior JET。它不是免费的,工作速度很慢,但您可以创建可执行文件(非常大的可执行文件)。我在 Windows 上测试了它并且有效。但它创建的可执行文件比使用 JRE 运行
.jar
慢。还有 GCJ。我尝试过,但是编译我的项目对我来说太难了。
我建议安装 JRE 并使用
.jar
文件。You can use Excelsior JET. It is not free, work quite slow, but you can create executable (very huge executable). I tested it on Windows and it worked. But executable it created was slower then
.jar
run using JRE.There is also GCJ. I tried it, but it was too hard for me to compile my project.
I suggest installing JRE and working with
.jar
file.