tags:

views:

9878

answers:

8

How do I run a .jar executable java file from outside NetBeans IDE? (Windows Vista). My project has a .jar file created by Netbeans. We'd like to run it. Either: how do we run the file or how do we create a 'proper' executable file in NetBeans 6.1?

+4  A: 

Running a jar is as simple as

java -jar filename.jar
Laplie
+1  A: 

from a command prompt you can run this command: java -jar your_jar.jar.

Josh Moore
A: 

You can do it from the command prompt if java isn't in your path by finding the full path to your java install, something like:

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 run the jar produced by netbeans.

Brian Gianforcaro
+3  A: 

as Laplie said, java -jar your.jar

EXECUTABLE file : see this thread for answers http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file

anjanb
A: 

|| rs.getString("normsFR").equals("0")?" - ":

A: 

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

Richie_W
A: 

First, make sure you set the Main Class in your NetBeans project properties dialog.
Then, you can either

  • Double-click the jar file (This should work on any machine with an installed JRE)

or

  • Make sure that java.exe is in the path (or replace java below with the fullpath and file name of the executable), put the following in a batch file:
    java -jar filename.jar
    Then you can double-click the batch file instead of the jar (useful if you have people unaccustomed to using naked jar files)

OR

Galghamon
A: 

One of the best technique to run the jar file or jar jar file step 1. Create the jar file by jar command choose yours jar file name a/c your self 4 exam Java_Jar_File.jar 2. Run the jar file us the command like java -jar Java_Jar_File.jar

Mr. Brahm Deo Sah