why doesn't my jar file run outside netbeans?

别说谁变了你拦得住时间么 提交于 2019-12-01 13:27:53

问题


I built a jar file that can run perfectly within netbeans when I click run, but when I try to run the jar file by double clicking it it does not run, nothing happens..


回答1:


Double-clicking the jar starts it, but unless you have a GUI application that opens a new window (in a different thread), it most likely finishes and closes before you can see anything.

In these cases you normally run the jar from the console (java -jar ..) to see if there are any exceptions/errors.




回答2:


Starting an application from the command line would let you debug the problem as Bozho said. But you need to check if you have all the files in dist folder that you need to run your program. For example if you are using a database file to get the data, you need to place this file in the dist folder after program is built. I think the jar file is using a relative path when looking for files.



来源:https://stackoverflow.com/questions/8811589/why-doesnt-my-jar-file-run-outside-netbeans

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