Content-type: text/html
java, javac, jre, jdb, javah, javap, javadoc, appletviewer, rmic, rmiregistry, serialver, native2ascii, jar, javakey - The Java Development Kit tools
java [ options ] classname <args> java_g [ options ] classname <args>
This reference page describes the java command only. The Java Development Kit (JDK) is part of the Java Virtual Machine (VM). If the JDK documentation was installed on your Digital UNIX system, you can view documentation on all of the JDK tools, and other Java reference material, at the following location:
/usr/share/doclib/java/index.html
The java command invokes an interpreter that executes Java bytecodes. It executes Java class files created by a Java compiler, for instance, javac.
Any arguments that appear after classname on the command line are passed to the main method of the class.
The java command expects the binary representation of the class to be in a file called classname.class, which is generated by compiling the corresponding source file with javac. All Java class files end with the filename extension .class which the compiler automatically adds when the class is compiled. classname must contain a main method defined as follows:
class Aclass {
public static void main(String argv[]){
. . .
}
}
java executes the main method and then exits unless main creates one or more threads. If any threads are created by main then java doesn't exit until the last thread exits.
Ordinarily, you compile source files with javac then run the program using java. However, java can be used to compile and run programs when the -cs option is used. As each class file is loaded its modification date is compared to the modification date of the class source file. If the source has been modified more recently, it is recompiled and the new class file is loaded. java repeats this procedure until all the classes are correctly compiled and loaded.
The interpreter can determine whether a class is legitimate through the mechanism of verification. Verification ensures prior to their execution that class files do not violate any language constraints.
java_g is a non-optimized version of java suitable for use with debuggers like jdb.
The classname argument is the name of the class to be executed. classname must be fully qualified by including its package in the name, for example:
% java java.lang.String
When you define your own classes you need to specify their location. Use CLASSPATH to do this. CLASSPATH consists of a colon separated list of directories that specifies the path. For example:
.:/home/xyz/classes
The system always appends the location of the system classes onto the end of the class path unless you use the -classpath option to specify a path.
Allows the Java debugger, jdb, to attach itself to this java session. When -debug is specified on the command line, java displays a password which must be used when starting the debugging session. When a compiled class is loaded, this option causes the modification time of the class bytecode file to be compared to that of the class source file. If the source has been modified more recently, it is recompiled and the new class file is loaded. Specifies the path java uses to look up classes. Overrides the default or the CLASSPATH environment variable if it is set. Directories are separated by colons. Thus the general format for path is: .:<your_path>
Used to provide the system a path to user-defined classes. Directories are separated by colons, for example, .:/home/xyz/classes:/usr/local/java/classes
If the JDK documentation was installed on your Digital UNIX system, you can view it at the following location:
/usr/share/doclib/java/index.html delim off