开发者

Can't Run JAR Files

开发者 https://www.devze.com 2022-12-11 11:50 出处:网络
开发者_JAVA百科I can run my project through netbeans but after I make a jar file and double click it I get the error cannot find Java runtime environment? I am on Windows.You don\'t have a file associ

开发者_JAVA百科I can run my project through netbeans but after I make a jar file and double click it I get the error cannot find Java runtime environment? I am on Windows.


You don't have a file associate created. Right click on the .jar file in Internet Explorer, select Open With, and navigate to your JRE. Select the java.exe executable, and make sure the command-line argument has ' -jar ' present.

The .jar file will be passed as the first argument to the JVM.


Make sure you have JRE installed. Open the console and type java -version


You should download a Java runtime environment.


You might try, as Chris said, making sure the JRE executable is part of your PATH environment variable. Check out "4. Update the PATH variable (Optional)" from this guide.


Make sure the JRE bin dir is in your PATH env variable.


It's all about the Manifest - http://java.sun.com/docs/books/tutorial/deployment/jar/manifestindex.html


In Netbeans run the project. It will ask you what class to run (you will see a list of all the classes with a "public static void main(String[])" method). Once you do that the next time you build the class netbeans will show you how to run it (with the -jar witch). Now you should be able to double click on it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号