如何为Java程序创建.exe? [重复]

时间:2022-11-25 14:04:06

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

可能重复:如何将我的java程序转换为.exe文件?

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:

我想为Java程序创建一个Windows .exe。以前,我已经使用过JEXECreator,但它并不完全令人满意,因为:

  • 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).

如果目标机器上没有安装Java,我不需要生成的.exe(事实上,我认为这是不可能的)。

Any recommendations?

有什么建议?

7 个解决方案

#1


31  

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

也许是Launch4j?不能说我自己用过它,但听起来就像你追求的那样。

#2


19  

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).

将java应用程序转换为.exe文件的大多数程序只是程序的包装器,最终用户仍然需要安装JRE才能运行它。据我所知,没有任何转换器可以使它成为字节码的本机可执行文件(已经有尝试,但如果有任何成功,你会听到它们现在)。

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

至于包装纸,我使用的最好的(如前所述)是:

JSmooth

JSmooth

and

Launch4j

Launch4j

best of luck!

祝你好运!

#3


8  

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

如果你真的想要一个exe Excelsior JET是一个专业级别的产品,可以编译为本机代码:

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

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

You can also look at JSMooth:

您还可以查看JSMooth:

http://jsmooth.sourceforge.net/

http://jsmooth.sourceforge.net/

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

如果您的应用程序与其兼容的AWT / Apache类路径兼容,那么GCJ将编译为本机exe。

#4


3  

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

我使用exe4j将所有java jar打包成一个最终的.exe文件,用户可以将其用作普通的Windows应用程序。

#5


1  

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

Java Service Wrapper可能会帮助您,具体取决于您的要求。

#6


1  

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

你可以尝试exe4j。这实际上是我们通过它的堂兄install4j使用的。

#7


-2  

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

如果在目标计算机上安装了Java,则无需创建.exe文件。一个.jar文件就足够了。

#1


31  

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

也许是Launch4j?不能说我自己用过它,但听起来就像你追求的那样。

#2


19  

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).

将java应用程序转换为.exe文件的大多数程序只是程序的包装器,最终用户仍然需要安装JRE才能运行它。据我所知,没有任何转换器可以使它成为字节码的本机可执行文件(已经有尝试,但如果有任何成功,你会听到它们现在)。

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

至于包装纸,我使用的最好的(如前所述)是:

JSmooth

JSmooth

and

Launch4j

Launch4j

best of luck!

祝你好运!

#3


8  

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

如果你真的想要一个exe Excelsior JET是一个专业级别的产品,可以编译为本机代码:

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

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

You can also look at JSMooth:

您还可以查看JSMooth:

http://jsmooth.sourceforge.net/

http://jsmooth.sourceforge.net/

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

如果您的应用程序与其兼容的AWT / Apache类路径兼容,那么GCJ将编译为本机exe。

#4


3  

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

我使用exe4j将所有java jar打包成一个最终的.exe文件,用户可以将其用作普通的Windows应用程序。

#5


1  

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

Java Service Wrapper可能会帮助您,具体取决于您的要求。

#6


1  

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

你可以尝试exe4j。这实际上是我们通过它的堂兄install4j使用的。

#7


-2  

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

如果在目标计算机上安装了Java,则无需创建.exe文件。一个.jar文件就足够了。