You have downloaded a program in JAR from the Internet and can't open it? Trying to double-click on its icon, does Windows ask you which software you intend to open it with or does it show you a Command Prompt window that automatically disappears after a few seconds? Don't despair. There is probably a problem on your computer related to associating the JAR files with Java, the software needed to run them.
So that you can open JAR file double-click, the latest version of the Java Runtime Enviromento del Java Development Kit (which contains the Java Runtime Environment plus all the tools needed to develop applications in Java format) and the Windows associations must be configured correctly.
I know, so it seems like a very difficult thing. And instead I assure you that you are very wrong! Try to put into practice the suggestions I am about to give you and you will see that, in one way or another, you will be able to run all the applications in JAR format that you have downloaded from the Internet. Maybe it will take some time to find the right solution but in the end, you will see, the work will pay off! But now come on, don't waste any more precious time, roll up your sleeves and start focusing on the information you find below. Enjoy the reading!
Install the Latest Version of the JRE or JDK
As just mentioned, to open JAR files you need the latest version of the Java Runtime Environment (or Java Development Kit). Then connect to the Java software website and download it to your PC by first clicking on the button Java Free Download and then Accept and start free download.
When the download is complete, open the file you just downloaded (eg. JavaSetupxx.exe o chromeinstall-xx.exe) and fai clic prima sul pulsado Yes and then Install. At this point, wait for all the components necessary to operate the software to be downloaded from the Internet, remove the check mark from the item relating to Yahoo! (to prevent the browser's main page or search engine from being changed), click on forward and finish the setup by clicking on Close.
If obsolete versions of Java Runtime Environment are found on your computer, at the end of the setup you will be asked to delete them: accept by clicking on Uninstall e forward and wait for the process to finish. This should take a few seconds.
Now try opening a JAR format file by double clicking on its icon and you should be able to view it. If not, don't be discouraged, go ahead with the tutorial and try to put the tips below into practice.
If you need the Java Development Kit, which as mentioned also contains the Java Runtime Environment, linked to this Web page, put the check mark next to the item Accept License Agreement collocata sotto the dicitura JAVA SE Development Kit xx and click on the link to download the software version that best suits your computer: Windows x64 if you are using a 64-bit Windows system, Windows x86 if you are using a 32-bit Windows system and so on.
When the download is complete, open the JDK installation package (eg. jdk-xx-windows-x64.exe) and first click on Next twice in a row and then on Close to finish the setup. For more details, read my guide on how to install Java where I explained you step by step how to proceed.
Please note: If you suspect that old versions of Java are left on your computer that were not detected by the setup, remove them by following the instructions in my tutorial on how to uninstall Java.
Reset the Association of JAR Files in Windows
If installing a new version of the Java Runtime Environment or Java Development Kit did not pay off, most likely it is because you need to reset the JAR file association in Windows. To perform this operation, you must first delete the references to the JAR files contained in the system registry and then communicate to Windows the exact "coordinates" of Java.
To delete Java references from the Windows registry, follow these steps.
- Awards Win + R on your PC keyboard to call up the panel Run;
- Type the command regedit in the window that opens, then click first on OK and then Si to access the Registry Editor;
- Locate the following keys in the left sidebar and delete them. To delete them, right click on their icon (the yellow folder) and select the item Delete from the menu that appears. Please, delete only the final folder (the one called .jar) and not the entire route!
Now proceed to restore the association of the JAR files with the Java Runtime Environment by following the instructions below.
- Open the Command Prompt with administrator privileges. If you don't know how to do it, search cmd in Start, right click on the Command Prompt icon and then select the item Run as administrator give the menu to compare;
- Type the command assoc .jar = JARFile and press Submit;
- Type the command ftype JARFile = "C: Program Files (x86) Java jre1.8.0_51 bin javaw.exe" -jar "% 1" and press Submit.
Note: instead of "C: Program Files (x86) Java jre1.8.0_51 bin javaw.exe you must enter the correct path of the Java Runtime Environment on your PC. To find it, go to Start > Computer > C:, select the folder Programs (if you are using a 32-bit operating system) or Programs (x86) (if you are using a 64-bit operating system) and find out the path to the file javaw.exe inside the folder Java.
Mission accomplished, or at least hopefully! Now try running a JAR application and see what happens. If everything went well it should boot up and work fine.
Set Environment Variables in Windows
In some cases, to open JAR files on Windows it is necessary to adjust the system environment variables. In a nutshell, these are the "coordinates" used by the operating system and some programs to trace the position of certain elements (including Java).
How you do it? I'll explain it to you right away: click on the folder icon located in the taskbar to open Explore Resources (o File Explorer), right click on the icon computer (o What PC) contained in the left sidebar and select the item Property give the menu to compare.
Nella finestra che si apre, select the voice Advanced system settings from the left sidebar and then presses the button Environment variables ... and make the following changes.
- Click on the button New ... located in the lower part of the window and creates a new environment variable with the following characteristics.
- Variable name: JAVA_HOME, Variable value: the path of the JRE or JDK (eg C: Program Files Java jdk1.8.0_31).
- Double-click the entry Path which is already present in the list System variables, arrives at the end of the field Variable value (don't delete anything!) and add the following: ;% JAVA_HOME% bin.
Once this is done, save the changes by clicking on OK, reboot your system and try starting your JAR files.
Please note: If you have only installed the Java Runtime Environment and have reached this point of the guide without success, try removing it, installing the Java Development Kit in its place and setting the environment variables as just explained.
Run JAR Files from the Command Prompt
In the unfortunate event that you haven't been able to double-click JAR files yet, you can try running one of the programs in this format using the Command Prompt.
Then start the Windows Prompt as I indicated in the previous lines (what I explained to you how to restore the association of JAR files in Windows), type the command java -jar followed by a space and drag the icon of the JAR file to be executed in the Prompt window, in order to obtain something like java -jar "C: Desktop application.jar. Finally, press the button Submit present on the computer keyboard and the application should start.
If any error messages appear in the prompt, try Google what they correspond to. You may be dealing with poorly compiled and therefore not executable applications. In that specific case, the problem would be the JAR file and not the Java installation on your PC!
Open JAR Files on Mac
Do you use a Mac? Then to open the JAR files you should just need to install the latest version of Java. How you do it? The process is good or bad identical to that seen together in the previous lines for Windows. In any case, don't worry, you will find everything below.
To start with, connect to the program website and click on the button first Java Free Download and then Accept and start free download. When the download is complete, to install the software on your computer, open the package in .dmg just downloaded and launch the file with extension pkg which is located inside.
Nella finestra che si apre, click on your button Continue twice in a row, then click Install and type the password of your user account on macOS / OS X (the one you use to log into the system). To conclude, click on Install software e Close. When installation is complete, right-click on the file to open and select the item apri from the menu that appears. If you need more info, you can read my article on how to install Java that I reported to you in the previous lines, when I explained how to install the latest version of JRE or JDK on Windows.
If you have any problems, try opening the terminal and use the command java -jar application.jar as seen above for Windows (requires JDK).