简体   繁体   English

导出的日食可运行.jar将无法运行

[英]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.

相关问题 Eclipse导出的Runnable JAR不显示图像 - Eclipse exported Runnable JAR not showing images Gradle依赖项未通过Eclipse导出到可运行的jar - Gradle dependencies not being exported to runnable jar by eclipse 带导出的可运行jar文件的Java Eclipse错误 - Java eclipse error with exported runnable jar file 我使用我的 javafx14 应用程序的 eclipse 导出了可运行的 jar 但无法运行该应用程序 - I exported a runnable jar using eclipse of my javafx14 application but cannot run the application 我在eclipse上有一个程序,并将其导出为可运行的JAR文件,如何双击运行它? - I have a program on eclipse and exported it as a runnable JAR file, how do I run it on a double click? 程序完全在Eclipse中运行,但是当导出为可运行的JAR文件时无法运行 - Program runs completely in Eclipse but does not run when exported as a Runnable JAR file 用eclipse导出的可运行jar不起作用,在eclipse中它仍然有效 - Runnable jar exported with eclipse isn't working, in eclipse it still works Eclipse导出的可运行jar中的java.lang.ClassNotFoundException - java.lang.ClassNotFoundException in runnable jar exported by Eclipse SmsLib App在Eclipse中运行但导出的可运行Jar出现以下问题? - SmsLib App working in Eclipse but exported runnable Jar has the following issue? 项目在Eclipse中正常运行,但导出到可运行的jar时无法正常运行 - Project runs normal in Eclipse but doesn't when exported to a runnable jar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM