java - the Java application launcher

SYNOPSIS

    java [ options ] class [ argument ... ]
    java [ options ] -jar file.jar [ argument ... ]
    javaw [ options ] class [ argument ... ]
    javaw [ options ] -jar file.jar [ argument ... ]
    oldjava [ options ] class [ argument ... ]
    oldjavaw [ options ] class [ argument ... ]

DESCRIPTION

The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class's main method. This method must have the following signature:
    public static void main(String[])
By default, the first non-option argument is the name of the class to be invoked. A fully-qualified class name should be used. If the -jar option is specified, the first non-option argument is the name of a JAR archive containing class and resource files for the application, with the startup class indicated by the Main-Class manifest header.

The Java runtime searches for the startup class, and other classes used, in three sets of locations: the bootstrap class path, the installed extensions, and the user class path.

Non-option arguments after the class name or JAR file name are passed to the main function.

On Win32 systems, java comes in four variations:

java
The basic launcher tool, which implements all 1.2 features and runs in the Win32 character subsystem. Shortcuts that use java create a console window.

javaw
Like java, but runs in the Win32 GUI subsystem. Shortcuts that use javaw do not create a console window. If run from an existing console window, the command returns immediately. Output to System.out and System.err is discarded. Use of System.in is not supported.

oldjava
A limited-feature launcher tool, which supports programming techniques that are incompatible with some 1.2 features.

oldjavaw
Like oldjava, but runs in the Win32 GUI subsystem.

JAVA AND OLDJAVA

These are the differences between java and oldjava

THE JIT

The default behavior of the launcher is to execute bytecodes using a Just In Time compiler, or JIT. When a class is loaded, the JIT translates the class bytecodes into native machine code. Using a JIT causes a slight delay after each class load, but can improve overall program performance. In some cases, execution time will improve by a factor of ten.

The Windows version of the JDK software includes the Symantec JIT, copyright © 1996-1998 by Symantec Corporation; all rights reserved.

If the JIT is disabled, bytecodes are executed directly by an interpreter. There are two ways to disable the JIT:

You can also set JAVA_COMPILER or java.compiler to the name of an alternative JIT. The launcher appends ".dll" to the JIT name and looks for a DLL file defining the JIT in the same directory as the launcher executable.

OPTIONS

The launcher has a set of standard options that are supported on the current runtime environment and will be supported in future releases. An additional set of non-standard options are specific to the current virtual machine implementation and are subject to change in the future. Non-standard options begin with -X

Standard Options

-classpath classpath
-cp classpath
Specify a list of directories, JAR archives, and ZIP archives to search for class files. Class path entries are separated by semicolons (;). Specifying -classpath or -cp overrides any setting of the CLASSPATH environment variable.

Used with java or javaw, -classpath or -cp only specify the class path for user classes. Used with oldjava or oldjavaw, -classpath or -cp specify the class path for both user classes and bootstrap classes.

If -classpath and -cp are not used and CLASSPATH is not set, the user class path consists of the current directory (.).

For more information on class paths, see Configuration of JDK 1.2 Software under Win32.

-Dproperty=value
Set a system property value.

-jar
Execute a program encapsulated in a JAR archive. The first argument is the name of a JAR archive file instead of a startup class name. The startup class is specified by the Main-Class manifest header. The JAR file is the source of all user classes, and other user class path settings are ignored.

The oldjava and oldjavaw tools do not support the -jar option.

-verbose
-verbose:class
Display information about each class loaded.

-verbose:gc
Report on each garbage collection event.

-verbose:jni
Report information about use of native methods and other Java Native Interface activity.

-version
Display version information and exit.

-?
-help
Display usage information and exit.

-X
Display information about non-standard options and exit.

Non-Standard Options

-Xbootclasspath:bootclasspath
Specify a semicolon-separated list of directories, JAR archives, and ZIP archives to search for boot class files. These are used in place of the boot class files included in the JDK 1.2 software.

-Xnoclassgc
Disable class garbage collection

-Xmsn
Specify the initial size of the memory allocation pool. This value must greather than 1000. To multiply the value by 1000, append the letter k. To multiply the value by 1 million, append the letter m. The default value is 1m

-Xmxn
Specify the maximum size of the memory allocation pool. This value must greather than 1000. To multiply the value by 1000, append the letter k. To multiply the value by 1 million, append the letter m. The default value is 16m.

-Xprof[:file]
Enable profiling. If no file is specified, write results to java.prof in the current directory.

-Xhprof[:keyword/value list}
Enable heap profiling. By default, results are written to heap.prof in the current directory, the stack trace is limited to 5, the top 20 allocation sites are reported, and results are sorted by the number of allocation objects. To specify other parameters, specify one or more keyword/value pairs. Separate pairs with commas. Valid parameters are:
file=file
Write report to file.
depth=n
Limit the stack trace to n.
top=n
Report the top n allocation sites.
sort=x
Sort order. Specify a to sort by number of allocation objects, l to sort by number of live objects.

-Xverify
-Xverify:all
Verify that all class files obey language constraints.

-Xverify:remote
Verify only remote class files. This is the default verification level.

-Xverify:none
Disable class file verification.

-Xrs
Reduce the use of operating system signals.

-Xcheck:jni
Perform additional check for Java Native Interface functions.

SEE ALSO