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 NEXT 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 NEXT 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.
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 Home, 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) Javajre1.8.0_51binjavaw.exe" -jar "% 1" and press Submit.
Note: instead of "C: Program Files (x86) Javajre1.8.0_51binjavaw.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.
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 FilesJavajdk1.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.
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!
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).How to open JAR