I'm currently having a problem opening my JAR file. I'm using NetBeans 6.7. It compiles successfully with no errors and I've a JAR file in my DIST folder. What happening is: Whenever i click on the file, command prompt opens up and within a second, it closes. THAT's it. No error code nothing. I've already tried adding new Environment Variable (JAVA_HOME) and pointed it to my JDK folder. Nothing is happening. Please help me out. ALSO: Do i need to download JRE in order to open up JAR file? Somewhere I read, JRE is already included in the JDK?
Asked
Active
Viewed 245 times
-4
-
1Open a command window, navigate to your DIST folder, and run this command: `java -jar yourjarname.jar` and see what the error is. – icza Nov 01 '14 at 13:20
-
possible duplicate of [Double Clicking JAR file does not open Command Prompt](http://stackoverflow.com/questions/10446986/double-clicking-jar-file-does-not-open-command-prompt) – Joe Nov 01 '14 at 13:23
-
1On python, for example if you open a program from command prompt it executes quickly and then closes the cmd. Is your program with GUI or console based? Not sure about JAR-s tho. – charen Nov 01 '14 at 13:31
1 Answers
0
For Command Line Applications, the Windows command prompt command java -jar jarfile.jar
will compile and execute your jar file. double clicking is when you want to run GUI applications.

namsnath
- 138
- 1
- 3
- 11