How to Run a JAR File on Windows

2023-04-26 02:47:39

Do you need to run a Java Archive (JAR) file on your device and can’t get it to work? You must have encountered different issues causing this. Solving this, 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 the choice between Java JDK (Java Development) or JRE (Java Runtime Environment). If you already have the latter, you can still run a Java file on your machine. Yet, many choose to have JDK because of the convenience it offers and since it has everything JRE has alongside other tools like compilers and debuggers. Yet, remember that without one of the two, running Java will not be possible. You will also run into a problem if Java is not the default program for your .jar files.

Command prompt - Java not available

So, to check if you have Java on your device, launch your command prompt (you can type it in your Start search bar and type cmd or use the shortcut Windows + R). Once the command prompt opens, type java -version and press Enter.

If Java is installed on your PC, the version of Java will be displayed. If not, you will receive a message stating: ‘java’ is not recognized as an internal or external command, executable program or batch file.

To download Java, go to its Download page, where you can choose from the different versions available. Once downloaded, click on the installer and follow the installation instructions. Restart your PC following that.

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 a Java icon, it may appear as a blank space or a WinRAR. With that, it’s time to set it as the default to run your .jar files.

Setting Java(TM) Platform SE Binary as default when opening .jar files

To get started, open your File Explorer and go to Options under the View tab. From the drop-down menu, select Change folder and search options. This will open a small window where you need to access the View tab. In the list, find Hide extensions for known file types. Click Apply, then click the OK button. This should add the .jar extension to the filename of your Java file.

Next, right click on the Java file and select the Open with option. You might immediately see the Java(TM) Platform SE Binary in the list of options, but select Choose another app instead. This will allow you to access the setting option Java(TM) Platform SE Binary as the default to run Java on your system. There, choose it and check the Always use this app to open .jar files. Click OK and your .jar file should now appear with a Java icon.

Java file does not work when double clicked. If your .jar file still does not launch when double-clicked, there is another way to fix this problem.

Navigate to the location where your .jar file is located. There, right-click on the black space and select Novelty. Choose Document texte. Once the text document is created, rename it to any name you like, but change the file extension from .SMS To .batClick on Oui to confirm the action when a prompt or warning is displayed. Again, make sure the .bat file you created is in the SAME LOCATION where your .jar file is.

creation of a .bat file to launch the Java application

Once the text document has been transformed into a Windows batch file, right-click on it and select Modifier. In the empty note that will appear, type java -jar (filename including .jar extension). For example: java -jar MSPowerUser.jar. To avoid errors, just copy the filename of the file. Once pasted, save and close the file. After that, instead of clicking on the .jar file, you will now use the .bat file to launch the Java application.

1682493260
#Run #JAR #File #Windows

Leave a Replay