Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jar file doesn't open upon double click

Tags:

java

windows

jar

When I double click the jar file, the GUI program doesn't start by itself. Instead I have to open the Command prompt and then type java -jar abc.jar and only then it starts up. Why is that? What do I need to do to avoid this?

Is it that I have some problem with the default jar file opener? What should be the jar file opener?

like image 912
program-o-steve Avatar asked Feb 13 '12 11:02

program-o-steve


People also ask

How do I run a .JAR file by double click?

Normally after installing Java, there will be an association between . jar and the javaw.exe. This enables the executable jar to be opened on double click. You can check the association by going to Control Panel -> Programs -> Default Programs -> Associate a file type or protocol with a program.

Why JAR file is not opening?

If you do not have Java installed, and the PATH variable is not set correctly, attempts to run a JAR file on Windows or Ubuntu will result in a 'Java not recognized' error. To run a JAR file, you must install the Java JDK or JRE on your computer.

How do I fix Java not opening?

Close all of the browser windows, then reopen any web pages that require Java. In most cases starting a new browser session should make the latest installed version of Java active in your browser. Note: If you are still prompted to update, try restarting your system.


2 Answers

Maybe you would like to follow the instructions in this post: Running JAR file on Windows.

Just a minor note though. The exact syntax for me to work was in my Windows XP: C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe -jar "%1" %

like image 112
user1485864 Avatar answered Sep 17 '22 21:09

user1485864


if nothing happens, then don't you get any error message like could not find main class or something similar?

I would suggest check your jar file association. On command-line type:

ftype | find "jarfile"

Sometimes, even resetting it works, find out the absolute path of JRE and run the command:

ftype jarfile="C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*  

This would most probably solve your problem.

like image 33
Johnydep Avatar answered Sep 18 '22 21:09

Johnydep