[英]Exported eclipse runnable .jar will not run
So i'm pretty new to programming and java and I finished a Prime number program. 所以我对编程和Java还是很陌生,我完成了素数程序。 It runs in the cmd and doesn't use any GUI.
它在cmd中运行,并且不使用任何GUI。 When I try to double click it the cmd window pops up for like a frame then disappears.
当我尝试双击它时,cmd窗口会弹出一个框,然后消失。 When I try to run it with the command "java -jar _____.jar" it works fine and it works fine in eclipse.
当我尝试使用命令“ java -jar _____。jar”运行它时,它工作正常,并且在eclipse中也工作正常。 Earlier I was getting an error saying that I don't have a main manifest attribute but it seemed to go away.
早些时候我遇到一个错误,说我没有主要的清单属性,但它似乎消失了。 If you guys know the fix to the main attribute thing I could try that.
如果你们知道主要属性的修复方法,我可以尝试一下。 Other than that anyone have any ideas?
除此之外,还有人有什么想法吗?
Here's a link to a previous similar question. 这是先前类似问题的链接 。 They have some good solutions there.
他们在那里有一些好的解决方案。
A simple one to try starting out is JarFix which will re-associate .jar files with the right java exe. JarFix是一个简单的尝试开始,它将重新将.jar文件与正确的Java exe关联。
If your program is immediately closing upon running, try adding snippet at the end of it to keep the process alive. 如果您的程序在运行时立即关闭,请尝试在其末尾添加代码段以使该进程保持活动状态。
System.out.println("Press enter to close.");
try {
System.in.read();
} catch (Exception e) {
e.printStackTrace();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.