How to run java executable .jar file from outside of NetBeans IDE?

How to run java executable .jar file from outside of NetBeans IDE? (Windows Vista). My project has a .jar file created by Netbeans. We would like to launch it. Either: how do we run the file or how do we create the β€œright” executable in NetBeans 6.1?

+7
java executable-jar
source share
10 answers

Running a jar is as easy as

java -jar filename.jar 
+17
source share

as Lapley said, java -jar your.jar

EXECUTABLE file: see this answer topic How do I convert my Java program to a .exe file?

+4
source share

One of the best ways to run a jar or jar jar file

  • Create a jar file with the jar command, select your jar file name Java_Jar_File.jar
  • Run the jar file with the command java -jar Java_Jar_File.jar
+3
source share

You can do this from the command line if java is not in your path by finding the full path to your java installation, for example:

 C:\java\java.exe -jar C:\jar_you_want_to_run.jar 

or if java is in your path:

 java.exe -jar jar_you_want_to_run.jar 

This will launch the jar produced by netbeans.

+2
source share

First, make sure you set the Main class in the NetBeans project properties dialog box.
Then you can

  • Double-click the jar file (this should work on any computer with a JRE installed)

or

  • Make sure java.exe is in the path (or replace java below with the full path and the name of the executable file), put the following in the batch file:
    java -jar filename.jar
    Then you can double-click the batch file instead of jar (useful if you have people who are not used to using bare jar files).

OR

  • You can follow the path described here How to convert my Java program to a .exe file? to create .exe for Windows.
+2
source share

Make a bat file with

 java -jar filepath.jar 
+2
source share

from the command line you can run this command: java -jar your_jar.jar .

+1
source share

To run the java jar file, its file association must be configured correctly. There is a free jarfix tool to fix all problems with combining jar files. Run this file to fix all problems with the banks.

+1
source share

In the project properties dialog box in NetBeans, you need to set the Main class - otherwise the generated .jar will not be executed. Then, as already indicated, either double-clicking on .jar or the java -jar command will launch the program.

0
source share

If you have problems launching your jar, make sure you are trying to run your current version to get the new version in Netbeans: GoTo Run Menu β†’ Clean and build

0
source share

All Articles