Running JAR file on Windows
Easiest route is probably upgrading or re-installing the Java Runtime Environment (JRE).
Or this:
- Open the Windows Explorer, from the Tools select 'Folder Options...'
- Click the File Types tab, scroll down and select JAR File type.
- Press the Advanced button.
- In the Edit File Type dialog box, select open in Actions box and click Edit...
- Press the Browse button and navigate to the location the Java interpreter javaw.exe.
- In the Application used to perform action field, needs to display something similar to
C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe" -jar "%1" %
(Note: the part starting with 'javaw' must be exactly like that; the other part of the path name can vary depending on which version of Java you're using) then press the OK buttons until all the dialogs are closed.
Which was stolen from here: http://windowstipoftheday.blogspot.com/2005/10/setting-jar-file-association.html
In Windows Vista or Windows 7, the manual file association editor has been removed.
The easiest way is to run Jarfix, a tiny but powerful freeware tool. Just run it and your Java apps is back... double-clickable again.
If you need to distribute your .jar file and make it runnable at other people's Windows computers, you can make a simple .bat file like this in the command prompt:
java -jar MyJavaTool.jar
and place the .bat file in the same directory as your .jar file.
If you have a jar file called Example.jar, follow these rules:
- Open a
notepad.exe
- Write :
java -jar Example.jar
- Save it with the extension
.bat
- Copy it to the directory which has the
.jar
file - Double click it to run your
.jar
file