There are two forms the command line can take.
1) java.exe -classpath
Each jar file is a full path to the file including the ".jar". The class to run is given at the end without a ".class" of course. The class of course needs to be in one of the jar files. "-cp" may be used instead of "-classpath".
Here's the part that always throws me. On crappy Windows, you separate your jar files on the command line with a semi-colon, ";", not a colon, ":" as it would be on a grown up operating system. In addition, on Windows, it doesn't handle drive letters well, as in "c:\my_jars\xyz.jar". Escape those, or use a different arrangement.
Here's the other form of the java command line.
2) java.exe -jar myfile.jar
In this form, the jar file should contain everything needed and the "main", or class to run, has to have been designated when the jar was created. When using the "-jar" option, classpath options are ignored.
Complete documentation is found here:
http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/java.htmlHave fun.
No comments:
Post a Comment