# How to run a .jar file



## Sk MightyMouse

I have windows xp and i was wondering how to run a .jar file


----------



## needtolearn

Google is your friend.

http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS293&q=jar+extension&btnG=Google+Search


----------



## Sk MightyMouse

I have search google and i cant find anything or the things they suggested didnt work
the google link u suggested only had programs that would scan for java errors


----------



## needtolearn

I don't even know what you mean by *how to run a Jar file* Jar is an extension. Never heard the term *run a file.*


----------



## Sk MightyMouse

sorry...i am talking about a extension


----------



## dissembly

needtolearn, i've heard the term "run a file" before. In fact, in the second link down of the google search you provided, here: http://www.fileinfo.net/extension/jar


> Archive that contains multiple Java files and is compressed using .ZIP compression; stores Java classes and metadata and may be digitally signed; *runs as a program* if the Java Runtime Environment (JRE) is installed on the computer.
> 
> *JAR files* are used by Mozilla Firefox, Thunderbird, SeaMonkey, and Sunbird to store themes and add-ons.


Obviously it's a self-executable file, though i think their meaning would have been clear anyway. They want a program that will enable a *.jar file to be opened (in this case, to 'run').

Sk MightyMouse, you need to check more than just the first link in a google search. The second link says that you need to have Java Runtime Environment on your computer to execute a *.jar file, and it recommends a program called "Java Runtime 1.1". There's your answer.


----------



## justpassingby

With java installed you'll be able to play a .jar file in your browser.

It's not meant to be run in any other way but you can read this for more informations :
http://ostermiller.org/opening_jar_files.html


----------



## Sk MightyMouse

I have JRE (Java Runtime Environment) on my computer. It says that there used by internet browsers but im not sure what that has to do with the .jar file im trying to run. Do i need to find the program JRE on my computer?


----------



## Sk MightyMouse

ok give me a minute to read the html and ill reply to see i could find out how to do it


----------



## justpassingby

If JRE was installed properly it should have been associated with .jar files. You may have associated another program with .jar files.

Try entering the location of the .jar file in your browser's address bar.


----------



## Sk MightyMouse

when you click on the .jar file, isnt it automatically suppose to associate it with JRE and "run it"


----------



## Sk MightyMouse

you mean enter it like C:\Documents and Settings\.....


----------



## justpassingby

Sk MightyMouse said:


> you mean enter it like C:\Documents and Settings\.....


just tested that and actually it won't play in the browser but it should prompt you to open the file with java.

If JRE is installed properly you can run the .jar file by typing 
java -jar c:\pathofthefile\nameofthefile.jar 
in a command prompt or using the start => run command.

Use this site to check whether java is installed properly :
http://www.java.com/en/download/help/testvm.xml


----------



## nickster_uk

I always run jar files the following way (unless it's a game or application which I install to my phone).

I basically create a shortcut to the file and edit that target box:
"C:\Program Files\Java\jre1.6.0_07\bin\javaw.exe" -jar "C:\location of jar file.jar"

You may need to edit the location of javaw.exe if you're using a different version of java and you will obviously have to change the location of .jar file as well.

Hope that helps :smile:


----------



## Sk MightyMouse

my target looks like this C:\Program Files\Java\jre1.6.0_07\bin\javaw.exe" -jar "C:\C:\Program Files\Java\jre1.6.0_07\bin\javaw.exe" -jar "C:\Documents and Settings\Brian\Desktop\.jar" is that rite


----------



## justpassingby

The name of the .jar file is missing and you repeated the javaw.exe part twice. Also make sure the javaw.exe file is in the c:\program files\java\bin\jre1.6.0_07\ folder, that can change if you have an older version than Version 6 Update 7. 

The target of the shortcut should be :
"C:\Program Files\Java\jre1.6.0_07\bin\javaw.exe" -jar "C:\Documents and Settings\Brian\Desktop\nameofthefile.jar"


----------



## Sk MightyMouse

wow it didnt work....like i double click it and it will give me the arrow with the hour glass and then nothing happens...do u think its cuz my files corrupt or something like that


----------



## justpassingby

As said in the link in post #7 not all .jar files are executables. Could you send us a link to that .jar file or zip and upload it here so we can take a look ?


----------



## sathis

Herewith iam attaching a JAR file 

Please check whether it is executable 

and Downloaded from this website *"http://www.stat.tamu.edu/~jhardin/applets/signed/Poiss.html"*


----------



## justpassingby

The java application at www.stat.tamu.edu/~jhardin/applets/signed/Poiss.html worked fine, the .jar file shows the message "invalid or corrupt jarfile" when I tried to run it.


----------



## Diacono

Very simple:

/path_to_your_java_bin_dir/java -jar your_jar_file.jar

that's all folks!!

Have fun...

Luis Camuñas


----------



## justpassingby

As already said by Nickster and me 


justpassingby said:


> If JRE is installed properly you can run the .jar file by typing
> java -jar c:\pathofthefile\nameofthefile.jar
> in a command prompt or using the start => run command.





nickster_uk said:


> I basically create a shortcut to the file and edit that target box:
> "C:\Program Files\Java\jre1.6.0_07\bin\javaw.exe" -jar "C:\location of jar file.jar"
> 
> You may need to edit the location of javaw.exe if you're using a different version of java and you will obviously have to change the location of .jar file as well.


Please don't post in old threads. Warning for sig rule violation issued (no advertisements please) and thread closed.


----------

