How to run a .jar file by double-clicking on Windows 7 64-bit?

Running the .jar file on the command line works fine, but I cannot run any .jar file by double-clicking on my Windows 7 (64). Nothing seems to happen after a double click.

I tried the ftype hint, but to no avail:

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

I reinstalled JDK 7 64-bit, but to no avail.

Any idea?

+74
java jar windows-7
Dec 14 '11 at 20:17
source share
19 answers

What is indicated in the right mouse button → Open with? Is some other program specified as the default program? Is the Java Runtime listed? If the Java Runtime runtime is specified, you can open it and make it the default program to run.

t

 Right Click -> Properties -> Change -> C: \ Program Files \ Java \ jre7 \ bin \ javaw.exe
+39
Dec 14 '11 at 20:35
source share

If you previously used the right click and opened with \ path \ to \ your \ javaw.exe, you need to delete the following registry key.

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar]

Then run

 C:\>assoc .jar=jarfile C:\>ftype jarfile="C:\path\to\your\javaw.exe" -jar "%1" %* 
+29
Jun 01 '15 at 10:36
source share

You can also run it from the command line (cmd) :

 java.exe -jar file.jar 
+18
Dec 21 '12 at 23:55
source share

For Windows 7:

  • Launch Control Panel
  • Click "Default Programs"
  • Click "Link file type or protocol to a specific program"
  • Double click .jar
  • Overview of C:\Program Files\Java\jre7\bin\javaw.exe
  • Click "Open"
  • Click OK
+15
Mar 17 '12 at 19:39
source share

If you try the unpopular answer :

For Windows 7:

  • Launch Control Panel
  • Click "Default Programs"
  • Click "Link file type or protocol to a specific program"
  • Double click .jar
  • Overview of C:\Program Files\Java\jre7\bin\javaw.exe
  • Click "Open"
  • Click OK

And the jar files still don't open (in my case, it was as if I had never double-clicked):
open Command Prompt (to be safe with administrator rights) and enter the following commands:

java -version This should return the version so that you can safely assume that java is installed.

Then run

java -jar "PATHTOFILE\FILENAME.JAR"

Read the result. You may find an error message.

+14
Nov 21 '13 at 16:41
source share

I had the same issue with .jar files that didn't open with a double click. It turned out that I had two versions of Java installed (Java 6 and 7). Removing Java 6 from the control panel -> Uninstalling a program is what ultimately allowed you to open .jar files with a double click without using a command window.

+6
Aug 08 2018-12-12T00:
source share

I tried all the above steps to solve the problem, but nothing helped. I installed JDK and JRE.

In my case, one jar file was opened by double-clicking, and the other did not open. I examined these files, and the probable reason was that the file to be opened was created using JAVA SE 6, and the one that was not opened was created using JAVA SE 7. Although the problematic JAR file was run from the command line (java [ CN00] myfile.jar).

I tried right-clicking -> Properties -> Change to javaw.exe in both the JDK \ bin directory and the JRE \ bin directory.

I was finally able to fix the problem by changing the javaw.exe path (from JDK \ bin to JRE \ bin) in the registry editor.

Go to the HKEY_CLASSES_ROOT \ jarfile \ shell \ open \ command , the value was

 "C:\Program Files\Java\jdk-11.0.1\bin\javaw.exe" -jar "%1" %* 

I changed it

 "C:\Program Files\Java\jre1.8.0_191\bin\javaw.exe" -jar "%1" %* 

and it worked. Now the JAR file can be opened by double-clicking.

+5
Oct 24 '18 at 3:12
source share

check this link http://ostermiller.org/opening_jar_files.html you may not have installed the runtime or your system could not open .jar files with JAVA

+1
Dec 14 '11 at
source share

I had a problem due to which Windows blocked its launch (Windows 10 Pro). Right-click the icon> properties> in the lower right corner, he can tell you that "Windows has blocked the functionality ........" next to it is checked the "Unlock"> uncheck the box> apply> to lock goes away, and then you can run it.

+1
Dec 01 '15 at 21:22
source share

change the default application for JAR files from java.exe to javaw.exe from the JAVA_HOME / bin folder.

This is because java.exe is a console application, but the JAR file needs a window to execute. Since javaw.exe is a windowed application, it is preferable for executing JAR files.

An alternative to this is that to some extent you can use the command line to run your JAR files simply by using the java keyword with the -jar attribute.

+1
Jun 06 '16 at 13:56 on
source share

This is my way:

  1. Create a bat file (openJar.bat example).

     @echo off start javaw -jar "%1" %* exit 
  2. Cut it and paste it into C: \ Program Files \ Java \\ bin (this step is not needed, but you have to do it).

  3. Right-click the jar file> Properties> Select Open With (Edit button) and select the bat file.
  4. Double-click the JAR file to verify it.
+1
May 01 '18 at 2:08
source share

http://www.wikihow.com/Run-a-.Jar-Java-File

  • Assuming you downloaded the Java JRE and / or Java SDK, then
  • To make associations, go to "My Computer", click on one of your disks (for example, C: .
  • When it is displayed, select “Tools”, “Folder Options” (or Properties ... in different places depending on the version of Windows).
  • Open Windows Explorer (just open any folder) to open the "Tools" → "Folder Options" window.
  • When you get to the “Folder Options” window, click on the “File Types” tab. You should be able to edit or add JAR files ( .jar extension)
  • Change the program used to open the JAR files. In the file selection window, go to the folder where the JRE is installed (it should be C:/Program Files/Java/... , check "Always open with" and select the javaw.exe file.
0
Dec 14 '11 at 20:23
source share

Installing the newest JRE fixed this for me.

(Although I used to have JDK and JRE (s)).

0
Feb 20 '15 at 3:03
source share

Your problem may also be in your customization of Java code, I mean that if your program somehow cannot implement the main class / main file ( entry point ), it will not run the /.jar program (specially created on the IDE) . To solve this on the IDE:

  • Right-click the project> Properties> Run> Browse Main Class> OK.
  • Clean and rebuild

Try to launch it now. Hope this helps.

0
May 15 '15 at 7:05
source share

This is not a file association problem, since you can run the application correctly through the command line.

The problem is double-clicking on the corresponding file launched by the application and executing from the file path as the base execution path. Any relative path will be computed from the file path, and everything you are trying to load is likely to be missing.

Nothing happens even if you surround all your entry point code with try / catch (exception) because java s throws Throwables and not Exceptions: to fix this at your entry point java surrounds the contents of the main method with try / catch (Throwable) (base class for exception and error) and debugging.

0
Jul 29 '15 at 9:09
source share

For this, I created the JAR_Runnr project. =)

http://projects.killerapplets.com/JAR_Runner/

0
Feb 12 '16 at 18:41
source share

Had to try this:

  1. Open command prompt as administrator
  2. Go to the folder with the file using the cd
  3. Type java.exe -jar *filename*.jar
  4. Press Enter

The application should appear immediately after that.

0
Aug 08 '18 at 7:28
source share

I had the same problem, and I searched for a solution on the Internet, and none of the suggestions opened if I double-click the .jar file.

In my case, the reason is that there are several versions of the JDK and JRE installed on my computer. Since I am a software developer and work with several different versions for different clients, I need to use several JDKs on my PC (Windows 10 Pro). So I don’t want to change system variables (like JAVA_HOME , JRE_HOME or PATH ), instead I use the command line to start Java in the user process whenever I want to use a different version.

When installing the JDK, it registers the association of .jar files with the latest version that we installed on the PC. If you right-click the .jar icon and select properties, it will show that the file opens with the "Java (TM) Platform SE Binary". If we look at the registry key: HKEY_CLASSES_ROOT\jarfile\shell\open\command , it will point to the latest version of the JDK.

It is not recommended (sometimes annoying) to change the registry key every time I want to start building an application from a different version.

Therefore, in my situation, it is impossible to simply double-click the .jar file to execute it. But instead, I myself found a solution to the problem.

Scenario:

There are several JDKs installed on the PC (1.7, 1.8, 9.0, 10.0, 11.0 and 12.0), so the latest installed version was 12.0.

problem

Want to double-click the .jar executable developed using JDK 1.8 and not working

This is my work around the solution:

  1. Create a shortcut for the .jar file you want to open.
  2. Right-click the shortcut icon and select "Properties" → "Shortcut" tab.
  3. Change the text in the target (for example, "D:\Dev\JavaApp1.8.jar" ) to

    " C:\Program Files\Java\jdk1.8.0\bin\javaw.exe " -jar " D:\Dev\JavaApp1.8.jar "

  4. Then click OK. Double-click the shortcut.

Now it should open the application.

0
May 28 '19 at 3:21
source share

I had the same problem: if you double-click the jar executable, and the Java application will not start.

So I tried to manually change the registry key, but it did not help me. Tried to reinstall JDK newer / older to no avail. (I have several versions of Java)

And I solved it only with the jarfix program. Jarfix automatically fixes the .jar association problem on Windows. (check regedit: PC\HKEY_CLASSES_ROOT\jarfile\shell\open\command )

What Johann Nepomuk Löfflmann says:

The main reason for the above problem is that the program stole the .jar association. If you installed the Java runtime for the first time, the jar file type is assigned to javaw.exe correctly. "jar" is short for "java archive" and javaw.exe is the right program to run .jar. However, on Windows, any program can steal a file type at any time, even if it is already associated with the program. Many zip / unzip programs prefer to do this because the jar is stored in .zip format. If you double-click on .jar, your batch program opens the file, and not javaw launches the program because your batch program ignores meta information, which is also stored in .jar. There is a low priority report 4912211 in the Oracle error database “add a mechanism to recover the captured .jar and .jnlp file extensions,” but it was closed as “Closed, Will Not Fix”.

You can also skip the connection to the .jar file if you use the free OpenJDK without an installer.

Please note: my OS is Windows 10, but the logic is for 7, 8, etc. is the same.

Useful links:
https://windowsreport.com/jar-files-not-opening-windows-10/ https://johann.loefflmann.net/en/software/jarfix/index.html

0
Aug 13 '19 at 15:33
source share



All Articles