I have made a Jar file, but I cant make it to run by double clicking.
It works fine using java -jar name.jar
or by making a batch file.
I have already reinstalled jdk1.8.0_102, set the JAVA_HOME
variable and javaw.exe
in the jre folder is already the default program to run it.
so how do I make it to run by double clicking?
Asked
Active
Viewed 1.2e+01k times
10

Asnira
- 313
- 1
- 4
- 9
-
This question has already been answered, try look here: http://stackoverflow.com/questions/8511063/how-to-run-jar-file-by-double-click-on-windows-7-64 – Emax Oct 11 '16 at 08:15
-
@Emax I did read those, none of them worked for me. – Asnira Oct 11 '16 at 11:12
-
[This answer](https://stackoverflow.com/a/8511277/207421) is the answer. – user207421 Nov 29 '17 at 01:27
-
1I downloaded a .jar file that I couldn't open. What worked for me was to download the latest version of Java: http://java.com/en/, just in case other people in the same situation as me came to this question – NicklasF Feb 14 '19 at 11:51
-
you may have different versions of JDK installed in your computer. In that case take a look at this solution:[https://stackoverflow.com/a/56334577/1068538](https://stackoverflow.com/a/56334577/1068538) – Dush May 28 '19 at 03:28
1 Answers
20
How do I run an executable JAR file? If you have a jar file called Example.jar, follow these rules:
Open a notepad.exe.
Write : java -jar Example.jar.
Save it with the extension .bat.
Copy it to the directory which has the .jar file.
Double click it to run your .jar file.

Lawrence Armour
- 317
- 2
- 4