问题描述
我在Eclipse中为我的项目导出了一个可运行的.jar文件,但我似乎无法通过双击执行它。使用java -jar program.jar从命令行运行它工作正常,虽然我可以留下批处理文件来运行它,但这样做很烦人。双击我从Eclipse导出的一些旧罐子工作正常。有人知道怎么修这个东西吗?我正在运行Windows 7 x64顺便说一句(但我有32位java)
I exported a runnable .jar file for a project of mine in Eclipse, but I can't seem to execute it with a double click. Running it from the command line with "java -jar program.jar" works fine, and while I could just leave a batch file to run it, it is rather annoying to do so. And double clicking some older jars that i've exported from Eclipse works fine. Anyone know how to fix this? I'm running windows 7 x64 btw(But i have 32-bit java)
编辑:完全忽略这个问题。这是我在32位日食中使用64位java的问题,以及我可能使用的变通方法。一旦我改为32位java,一切都已修复。
Ignore this question completely. It was a problem of me using 64 bit java in 32 bit eclipse, and the workarounds i may have used. Once I changed to 32 bit java, everything was fixed.
推荐答案
如果它是一个控制台应用程序,那么它可能无法打开虽然应用程序可能在后台运行,但双击时命令提示符。我建议为控制台应用程序制作批处理文件。
If it's a console application then it probably won't open the command prompt on double click although the app may be running in the background. I recommend making batch files for console applications.
如果它是一个Swing应用程序但仍然无法双击运行,你应该尝试使用这个 http://launch4j.sourceforge.net/
If its a Swing application and still won't run on double click you should try wrapping as an exe file using this http://launch4j.sourceforge.net/
这篇关于如何通过双击从Eclipse运行导出的.jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!