How do I create an .exe for a Java program? [duplicate]

坚强是说给别人听的谎言 提交于 2019-11-26 00:48:26

问题


Possible Duplicate:
How can I convert my java program to an .exe file ?

I\'d like to create a Windows .exe for a Java program. Previously, I\'ve used JEXECreator for this, but it\'s not entirely satisfactory because:

  • The executable sometimes works on the machine on which it was created but not on others.
  • The program is commercial; if you use the trial version, it adds a nag screen to your application.

I don\'t need the generated .exe to work if Java is not installed on the target machine (in fact, I think this is impossible).

Any recommendations?


回答1:


Launch4j perhaps? Can't say I've used it myself, but it sounds like what you're after.




回答2:


Most of the programs that convert java applications to .exe files are just wrappers around the program, and the end user will still need the JRE installed to run it. As far as I know there aren't any converters that will make it a native executable from bytecode (There have been attempts, but if any turned out successful you would hear of them by now).

As for wrappers, the best ones i've used (as previously suggested) are:

JSmooth

and

Launch4j

best of luck!




回答3:


If you really want an exe Excelsior JET is a professional level product that compiles to native code:

http://www.excelsior-usa.com/jet.html

You can also look at JSMooth:

http://jsmooth.sourceforge.net/

And if your application is compatible with its compatible with AWT/Apache classpath then GCJ compiles to native exe.




回答4:


I used exe4j to package all java jars into one final .exe file, which user can use it as normal windows application.




回答5:


You could try exe4j. This is effectively what we use through its cousin install4j.




回答6:


The Java Service Wrapper might help you, depending on your requirements.




回答7:


If Java is installed on the target machine, there is no need to create an .exe file. A .jar file should be sufficient.



来源:https://stackoverflow.com/questions/516399/how-do-i-create-an-exe-for-a-java-program

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!