Do you need to run a Java Archive (JAR) file on your device and can’t get it to work? Due to this you might have faced various issues. Solving it, however, should be easy. Read on, and we’ll show you some of the most useful tips and procedures you can try to effectively run a JAR file on Windows.
Check your device for Java. Make sure your device has Java, which is required to run JAR files on Windows. You have a choice between the Java JDK (Java Development) or the JRE (Java Runtime Environment). If you already have the latter, you can still run the Java file on your machine. Still, many people choose JDK because of the convenience it provides and since it has everything that JRE has along with other tools like compilers and debuggers. However, remember that it would not be possible to run Java without either of them. You will still face a problem if Java is not the default program for your .jar files.
So to check if you have java on your device, launch your command prompt (you can do this in your start search bar and type CMD or use the Windows + R shortcut). Once the command prompt is open, type java -version and press Enter.
If you have Java installed on your PC, the version of Java will be displayed. If not, you will receive a message that reads: ‘java’ is not recognized as an internal or external command, operable program or batch file.
To download Java go to download Page, where you can choose from the different versions available. Once downloaded, click on the installer and follow the instructions for installation. After that restart your PC.
Make Java the default for your .jar files. Before this step, you may notice that your java file looks nothing like a java file. Instead of the Java icon, it may appear blank or as WinRAR. With that, it’s time to set it as the default for running your .jar files.
To start, open your File Explorer and go to Options under the View tab. from the dropdown, select Change folder and find option, This will open a small window where you need to go to the View tab. From the list there, find hide extensions for known file types. Click on Apply, then the OK button. It should add .jar extension to the file name of your java file.
Next, right-click on the Java file and select open with Option. you can see right away Java(TM) Platform SE Binary from the list of options, but choose choose another app instead. This will allow you to access the option to set Java(TM) Platform SE Binary As default for running java in your system. There, select it and check always use this app to open jar files, Click OK, and your .jar file should now appear with a Java icon.
java file is not working on double click. If your .jar file still doesn’t launch when you double-click it, there’s another way to solve this problem.
Go to the location where your .jar file is located. At that point, right-click on the black spot and choose New, choose text document, Once the text document is created, rename it to whatever name you want, but keep the file extension .txt To bat, Click Yes When a prompt or warning appears to confirm the action. Again, make sure the .bat file you create is in the same location as your .jar file.
Once the text document has been converted to a Windows batch file, right-click on it and choose edit, Type in the blank note that appears java -jar (filename with .jar extension), For example: java -jar MSPowerUser.jar. To prevent errors, simply copy the file name of the file. Once pasted, save and close the file. Next, instead of clicking on the .jar file, you will now use the .bat file to launch the Java application.