Java 1.1, and jar files

This page assumes you want to run a .jar file. If you have a directory full of classes, replace the name of the jarfile, with "."

For command-line oriented environments, you should be able to do something like

java -cp progname.jar ClassName
or possibly
jre -cp progname.jar ClassName
[note that there is no ".class" after ClassName]

However, you probably don't want to type that every time you want to run the program. So you'll have to put it in a shellscript, or .bat file.

For MS-DOS/ms-windows based machines, you would just pull up notepad, and put one of the above marked lines in "somefile.bat". You may have to specify the FULL path, however. Eg:

C:\Program files\javasoft\jre\1.1\jre -cp progname.jar ClassName

For unix based machines you would put one of the top-marked lines in some text file, and make it a shellscript. So,

#!/bin/sh
jre -cp progname.jar ClassName
Don't forget to run "chmod 0755 textfile", on the textfile you make, so it will actually do something!

If you have a mac, look at my macintosh java page


If you have any suggestions, comments, or "hey, it works on platform xxx, cool", drop me a line! [email protected]

Bolthole.com