Namejava---The Java Interpreter
JDK 1.0 and later.
java [ interpreter options ] classname [ program arguments ] java_g [ interpreter options ] classname [ program arguments ]
java is the Java byte-code interpreter--it runs Java programs. java_g is a debugging version of the interpreter. It is unoptimized, and has some additional options for tracing the execution of a program.
The program to be run is the class specified by classname. This must be a fully qualified name, it must include the package name of the class, but not the .class file extension. Note that you specify the package and class name, with components separated by '.', not the directory and filename of the class, which has its components separated by '/' or '/'. If a Java class has no package statement, then it is not in any package, and the class name is specified alone. Examples:
% java david.games.Checkers % java test
See the description of the -classpath option and the CLASSPATH environment variable below for information on specifying where java should look for classes.
The class specified by classname must contain a method main() with exactly the following signature:
public static void main(String argv)
Any arguments following the classname on the java command line are placed into an array and passed to the main() method when java starts up.
If main() creates any threads, java runs until the last thread exits. Otherwise, the interpreter executes the body of main() and exits.
Although only a single class name is specified when invoking java, the interpreter automatically loads any additional classes required by the program. These classes are located relative to the Java class path, described under the -classpath option below.
By default, java runs a byte-code verifier on all classes loaded over the network. This verifier performs a number of tests on the byte-code of the loaded class to ensure, for example, that it does not corrupt the internal operand stack and that it performs appropriate run-time checks on such things as array references. The -verify, -noverify, and -verifyremote options control the byte-code verification process.