Executable jar doesn't start normally

戏子无情 提交于 2019-12-25 00:09:02

问题


I created an executable jar file with eclipse indigo, but when i double click on it nothing happens. But when i write java -jar c:/dir/filename.jar to cmd, it works. Other jars runs well. I'm using jdk 1.7.0_02 and eclipse indigo. How could i start it normally?


回答1:


You can run a jar by double clicking it, you just have to make sure that Java is associated with .jar files. The easiest way to do this is by reinstalling the JRE (which generally does it for you).

Otherwise you will need to modify some of your Windows properties (I'm not sure what version of Windows you are running) to point .jar files to the instance of javaw.exe.

Here's a link to a Windows 7 page on how to do it.




回答2:


right click on .jar file and go to properties, then set "open with" program to "Java SE Binary".




回答3:


You can do this by associating the .jar extension with the command to run it via javaw.exe.

"C:\Program Files\Java\{java version}\bin\javaw.exe" -jar "%1" %*


来源:https://stackoverflow.com/questions/8784300/executable-jar-doesnt-start-normally

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