Executing Jar Files
One of the most useful associations to
set up is to make *.jar files executable with java.exe
(see below for details how). Then you can just type
the name of the jar on the command line to start it executing. ForJava version 1.4 or later, after you have built the Main-Class
entry, and set up an association of the *.jar
extension to C:\Program Files\java\jre7\bin\java.exe,
all you need to do to run the jar is:
converter.jar
or
java.exe -jar converter.jar
Watch out. Java install sometimes
sets the association back to
javaw.exe, no console!
If you get unhandled
Exceptions, you will never find out about the errors, stack dumps or any other error messages!
ForJava version 1.1, you need a little more, something like this:
To run the jar in an Applet, see
Applet for some sample HTML (Hypertext Markup Language) or see
on doing it.
Making Jar Files Double Clickable
In W98/Me/NT/W2K,
you can set up the extension *.jar so that when you
double click on a jar file in the disk explorer it will start executing the main-class
of the jar. In XP/W2003/Vista/W7-32/W7-64, you need to buy an associations
editor utility such as Creative Element Power
Tools.
- Click Start ⇒ Disk Explorer ⇒ View ⇒ Options ⇒
File Types ⇒ Executable Jar file ⇒ edit.
- If there is no Executable Jar file entry click
new to create one and fill in the Description of type to jar
- Java executable.
- Change the name of the entry from Executable Jar file
to something that will sort where you expect it like jar -
Java executable.
- Change the content type to the proper
MIME (Multipurpose Internet Mail) type application/java-archive. See MIME
for details.
- Set default extension for Content type to *.jar.
- Click open ⇒ edit .
- If there is no open, Click new and set the action to open.
- Set the application to perform to: "C:\Program Files\java\jre7\bin\javaw.exe"
-jar "%1". You can browse or adjust as necessary to account for
where you put your javaw.exe. javaw.exe
will hide the console output. To see the console output, associate java.exe
instead. I always associate with java.exe myself.
Without the console output, if anything goes wrong, you have no clue what the
problem is.
- Uncheck DDE.
- Click OK.
- Click new and set the action to execute.
- Set the application to perform to: "C:\Program Files\java\jre7\bin\javaw.exe"
-jar "%1". You can browse or adjust as necessary to account for
where you put your javaw.exe
- Uncheck DDE.
- Click OK.
- Click new
and set the action to edit.
- Set the application to perform to: "C:\Program Files\WinZip\winzip32.exe"
"%1". You can browse or adjust as necessary to account for
where you put your WinZip program.
- Uncheck DDE.
- Click OK.
- Click execute ⇒ set default.
- Click always show extension.
- click change icon. Choose a nice icon. Perhaps some
friendly artist could provide me with an jar.ico file
I could share with everyone.
- click close, close.
- Write a letter to Microsoft asking them to automate this bubblegum. Tell them to
end the warring between apps. Allow more than one app to register per function.
The ones you use most often should bubble to the top. Tell them that whether
apps are properly installed or uninstalled, this information should be self-healing.