简体   繁体   English

可执行jar无法正常启动

[英]Executable jar doesn't start normally

I created an executable jar file with eclipse indigo, but when i double click on it nothing happens. 我用eclipse indigo创建了一个可执行的jar文件,但是当我双击它时什么也没有发生。 But when i write java -jar c:/dir/filename.jar to cmd, it works. 但是当我将java -jar c:/dir/filename.jar写入cmd时,它可以工作。 Other jars runs well. 其他罐子运行良好。 I'm using jdk 1.7.0_02 and eclipse indigo. 我正在使用JDK 1.7.0_02和Eclipse Indigo。 How could i start it normally? 我如何正常启动?

You can run a jar by double clicking it, you just have to make sure that Java is associated with .jar files. 您可以通过双击运行一个jar,只需确保Java与.jar文件关联。 The easiest way to do this is by reinstalling the JRE (which generally does it for you). 最简单的方法是重新安装JRE(通常会为您完成)。

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. 否则,您将需要修改某些Windows属性(我不确定您正在运行的Windows版本),以将.jar文件指向javaw.exe实例。

Here's a link to a Windows 7 page on how to do it. 这是有关如何执行此操作的Windows 7页面的链接

右键单击.jar文件并转到属性,然后将“打开方式”程序设置为“ Java SE Binary”。

您可以通过将.jar扩展名与通过javaw.exe运行它的命令相关联来完成此操作。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM