Jar files wont open

Saul9868

New Member
As the title says. I've tried reinstalling java and updating windows but they didnt work, All .jars simply wont open.
 

Neemobeer

Windows Forum Team
Staff member
If the jar is a "console app" it may not actually show anything since there is no GUI.

One option would be to add a protocol handler for JAR files. This is something Oracle doesn't do, but the registry keys would look like what is below *****JAVA PROTOCOL *****
The two bold items would need to be changed to match your java version and save everything below *****JAVA PROTOCOL ***** save to a .reg file and double click it to import.

By default though Java should add the following registry values which also should allow jars to be executed.
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.jar]
@="jarfile"

[HKEY_CLASSES_ROOT\jarfile]
@="Executable Jar File"

[HKEY_CLASSES_ROOT\jarfile\shell]

[HKEY_CLASSES_ROOT\jarfile\shell\open]

[HKEY_CLASSES_ROOT\jarfile\shell\open\command]
@="\"C:\\Program Files (x86)\\Java\\jre1.8.0_211\\bin\\javaw.exe\" -jar \"%1\" %*"



*****JAVA PROTOCOL *****
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\JAVA.URI.JAR]

[HKEY_CLASSES_ROOT\JAVA.URI.JAR\shell]

[HKEY_CLASSES_ROOT\JAVA.URI.JAR\shell\open]

[HKEY_CLASSES_ROOT\JAVA.URI.JAR\shell\open\command]
@="\"C:\\Program Files (x86)\\Java\\jre1.8.0_211\\bin\\javaw.exe\" -jar \"%1\" %*"

[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"JarFile"="Software\\JavaSoft\\Capabilities"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Capabilities]
"ApplicationName"="Java.Jar"
"ApplicationDescription"="Java jar runtime"
"ApplicationIcon"="\"C:\\Program Files (x86)\\Java\\jre1.8.0_211\\bin\\javaw.exe\""

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Capabilities\FileAssociations]

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Capabilities\URLAssociations]
"javajar"="JAVA.URI.JAR"
 

AdrianG001

Active Member
As the title says. I've tried reinstalling java and updating windows but they didnt work, All .jars simply wont open.
Create a .bat file

You can run jar files on Windows 10 by using this simple workaround. This solution requires you to create a .bat file and use it every time you want to run a specific jar file. The process is rather simple and you can do it by following these steps:

  1. Locate your jar file. In the same folder, create a new Notepad file. To do that, right-click empty space in the directory and choose New > Text Document.
  2. When Notepad opens, enter java -jar filename.jar. Be sure to replace filename.jar with the actual name of the file.
  3. Navigate to the File > Save as.
  4. Set Save as type to All files. Now, enter the desired name for the file. Keep in mind that you need to have .bat as an extension or else the solution won’t work. Save the file in the same location where your jar file is located.
After doing that, locate your .bat file and double-click it. Your jar file will now open. Keep in mind that you need to repeat this process for every jar file that you want to run on your PC or cloud desktop. In addition, be sure to save the .bat file in the same location as your jar file.

OR

Set file association

  1. Open the Settings app. Navigate to the System > Default apps.
  2. Scroll all the way down and select Choose default apps by file type.
  3. Locate the .jar file type and choose a default application.
This method offers limited options and you can only choose applications recognized by Windows 10. Fortunately, there’s another method that you can try. To change file associations, do the following:
  1. Press Windows Key + X to open Win + X menu and choose Control Panel from the list.
  2. When Control Panel opens, select Default Programs.
  3. Click on Associate a file type or protocol with a program.
  4. Locate the .jar file on the list and double-click it.
  5. A list of suggested applications will appear. Click on More apps.
  6. Scroll all the way down and choose Look for another app on this PC.
  7. Locate the javaw.exe file. By default, the application should be located in Program Files folder. Select the application and choose it as a default for .jar files.
  8. Optional: Some users recommend changing the parameters of javaw.exe. To do that, simply locate the file and create its shortcut. Right-click it and navigate to the Properties. Now, locate the Target file and add -jar “%1” % . Be sure to select this newly created shortcut in Step 7.
You can also change file association by right clicking the jar file and choosing Open With > Choose another app. After doing that, follow the steps 5 to 8 from the above.



Regards,
Adrian
 
Top