1. Ensure that Java 11 (Azul’s Zulu OpenJDK 11 is preferable) is installed and accessible, from your shell of choice, type: java -jar launcher.jar; If that does not work, try java -classpath path to classes.zip:launcher.jar install; If that does not work either, on sh-like shells, try cd to directory where launcher.jar is located CLASSPATH.
  2. Eclipse can be started directly with java using, for example: java -jar plugins/org.eclipse.equinox.launcher1.0.0.v20070208a.jar. It is also possible to copy this bundle into the root and name it startup.jar. In this case it would be possible to start with java -jar startup.jar. Finding a VM, Using JNI Invocation or Executing Java.

Every Java programmer knows - or should known - that it is possible to create a runnable Java package archive (JAR), so that in order to launch an application it is enough to specify the jar file name on the Java interpreter command line along with the -jar parameter. For example:

There are plenty of tutorials showing how to implement this feature using Ant, Maven, Eclipse, Netbens, etc.

Anyway in its basic form, it just requires to add a MANIFEST.MF file to the jar package. The manifest must contain an entry Main-Class that specifies which is the class defining the main method for your application. For example:

Right-click the JAR file and select Open with from the context menu. Then select Choose another app and then select it to open with Java Platform SE binary. Check the option Always use this app to open Jar files. Then press OK to continue.

Java Jar Netbeans

But this still requires your users to invoke the Java interpreter with the -jar option. There are many reasons why it would be preferable to have your app runnable by simply invoking it on the terminal shell like any other command.

Here comes the protip!

This technique it is based on the ability to append a generic binary payload to a Linux shell script. Read more about this here: http://www.linuxjournal.com/content/add-binary-payload-your-shell-scripts

Taking advantage of this possibility the trick is just to embed a runnable jar file into a Bash script file. The script when executed will launch the Java interpreter specifying itself as the jar to run. Too complex? Much more easier to do in practice, than to explain!

Let's say that you have a runnable jar named helloworld.jar

Copy the Bash script below to a file named stub.sh

Than append the jar file to the saved script and grant the execute permission to the file resulting with the following command:

That's all!

Now you can execute the app just typing helloworld.run on your shell terminal.

The script is smart enough to pass any command line parameters to the Java application transparently. Cool! Isn't it ?!

In the case your are a Windows guy, obviously this will not work (except you will run a Linux compatibility layer like Cygwin).

Anyway exist tools that are able to wrap a Java application into a native Windows .exe binary file, producing a result similar to the one explained in this tutorial. See for example http://launch4j.sourceforge.net/

Summary :

JAR files are commonly used on Windows computers. Hence, do you know how to run .JAR files on Windows 10? This post from MiniTool shows how to run JAR files on Windows 10. In addition, you can visit MiniTool to find more Windows tips and solutions.

What Are JAR Files?

A JAR is a package file format typically used to aggregate many Java class files and associated metadata and resources, such as text, images,etc. into one file for distribution. JAR files are archive files that include a Java-specified manifest file. They are built on the ZIP format and typically have a .jar file extension.

Java

However, do you know how to run .JAR files on Windows 10? If no, keep on your reading, and the following part will show you how to run JAR files.

How to Run JAR Files on Windows 10?

In this part, we will show you how to run .JAR files with several different ways.

Way 1. Add Java to Windows

The first way you can try to open JAR files is to add Java to Windows. Without it, Java apps will not run on Windows and the JAR files also will not be opened.

So, in order to run .JAR files, you need to add JAVA to Windows. Now, here is the tutorial.

  1. Open Command Prompt.
  2. Next, type java -version in the Command Line window and hit Enter to continue. It will show you the further details of Java version on your computer.
  3. If there is no Java on your computer, click here to download the latest one.
  4. Then run it on your computer.

After all steps are finished, you can run .JAR files through the JAVA app.

Way 2. Open JAR Files with JAVA Platform SE Binary

In order to run JAR files, you can also choose to run it through the JAVA Platform SE Binary.

Now, here is the tutorial.

  1. Right-click the JAR file and select Open with from the context menu.
  2. Then select Choose another app and then select it to open with Java Platform SE binary.
  3. Check the option Always use this app to open Jar files.
  4. Then press OK to continue.

After all steps are finished, you can open JAR files on Windows 10 through the JAVA Platform SE binary.

Way 3. Open JAR Files with Command Prompt

Besides the above method, you can also run .JAR files through the Command Prompt.

Now, here is the tutorial.

  1. Open Command Prompt as administrator.
  2. Type the command –jar c:pathtojarfile.jar in the Command Line window and hit Enter to continue. Please replace the c:pathtojarfile.jar with the actual path and file title of the JAR you need to run in Windows.

Then, it will open the executable JAR file so long as it contains manifest file to specify the applications entry point.

Way 4. Add a Third-Party JAR Executor

As for how to run JAR files, you can use the third-party JAR executor and there are various JAR executors on the market. So, in order to run the JAR file, you can download a third-party JAR executor. After that, you can open the JAR file successfully.

Final Words

Java Jar Api

To sum up, as for how to run.JAR files, this post has introduced 4 ways. So, if you want to run .Jar files on Windows 10, you can try these ways. If you have any better idea to run .JAR files, you can share it in the comment zone.