Appendix B

java

The java program is a tool for launching a Java program. Its syntax has two forms.

java [options] class [argument ...]
java [options] -jar jarFile [argument ...]

where options represents command-line options, class the name of the class to be invoked, jarFile the name of the jar file to be invoked, and argument the argument passed to the invoked class’s main method

Options

There are two types of options you can pass to java, standard and nonstandard.

Standard Options

-client 

Select the Java HotSpot Client VM.

-server 

Select the Java HotSpot Server VM.

-agentlib:libraryName[=options] 

Load native agent library libraryName. Example values of libraryName are hprof, jdwp=help, and hprof=help.

-agentpath:pathname[=options] 

Load a native agent library by full pathname.

-classpath classpath 

The same as the -cp option.

-cp classpath 

Specify a list of directories, jar archives, and zip archives to search for class files. Two class paths are separated by a colon in Unix/Linux and by a semicolon in Windows. For examples on using -cp and –classpath, see the description of the javac tool’s classpath option in Appendix A.

-Dproperty=value 

Set a system property value.

-d32 

See the description of the –d64 option.

-d64 

Specify whether the program is to be run in a 32-bit or a 64-bit environment if available. Currently only the Java HotSpot Server VM supports 64-bit operation, and the -server option is implicit with the use of -d64. This is subject to change in a future release. If neither -d32 nor -d64 is specified, the default is to run in a 32-bit environment, except for 64-bit only systems. This is subject to change in a future release.

-enableassertions[:<package name>"..." | :<class name> ] 

See the description for the –ea option.

-ea[:<package name>"..." | :<class name> ] 

Enable assertions. Assertions are disabled by default.

-disableassertions[:<package name>"..." | :<class name> ] 

See the description for the –da option.

-da[:<package name>"..." | :<class name> ] 

Disable assertions. This is the default.

-enablesystemassertions 

See the description for the –esa option.

-esa 

Enable asserts in all system classes (set the default assertion status for system classes to true).

-disablesystemassertions 

See the description for the –dsa option.

-dsa 

Disables asserts in all system classes.

-jar 

Execute a Java class in a jar file. The first argument is the name of the jar file instead of a startup class name. To tell java the class to invoke, the manifest of the jar file must contain a line of the form Main-Class: classname, where classname identifies the class having the public static void main(String[] args) method that serves as your application's starting point.

-javaagent:jarpath[=options] 

Load a Java programming language agent.

-verbose 

See the description for the –verbose:class option.

-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 the JRE version information and exit.

-showversion 

Display the version information and continue.

-? 

See the description for the –help option.

-help 

Display usage information and exit.

-X 

Display information about nonstandard options and exit.

Nonstandard Options

-Xint 

Operate in interpreted-only mode. Compilation to native code is disabled, and all bytecodes are executed by the interpreter. You will not be able to enjoy the performance benefits offered by the Java HotSpot VMs’ adaptive compiler.

-Xbatch 

Disable background compilation so that compilation of all methods proceeds as a foreground task until it completes. Without this option, the VM will compile the method as a background task, running the method in interpreter mode until the background compilation is finished.

-Xdebug 

Start with support for JVMDI enabled. JVMDI has been deprecated and is not used for debugging in Java SE 5 and later.

-Xbootclasspath:bootclasspath 

Specify a list of directories, jar archives, and zip archives to search for boot class files. Entries are separated by colons (in Linux/Unix) or by semicolons (in Windows). These are used in place of the boot class files included in Java 5 and 6.

-Xbootclasspath/a:path 

Specify a list of directories, jar archives, and zip archives to append to the default bootstrap class path. Entries are separated by colons (in Linux/Unix) or by semicolons (in Windows).

-Xbootclasspath/p:path 

Specify a list of directories, jar archives, and zip archives to prepend in front of the default bootstrap class path. Entries are separated by colons (in Linux/Unix) or by semicolons (in Windows).

-Xcheck:jni 

Perform additional checks for Java Native Interface (JNI) functions. Specifically, the Java Virtual Machine validates the parameters passed to the JNI function as well as the runtime environment data before processing the JNI request. Any invalid data encountered indicates a problem in the native code, and the JVM will terminate with a fatal error in such cases. Using this option imposes a performance penalty.

-Xfuture 

Perform strict class-file format checks. For backwards compatibility, the default format checks performed by the Java 2 SDK’s virtual machine are no stricter than the checks performed by 1.1.x versions of the JDK software. This flag turns on stricter class-file format checks that enforce closer conformance to the class-file format specification. Developers are encouraged to use this flag when developing new code because the stricter checks will become the default in future releases of the Java application launcher.

-Xnoclassgc 

Disable class garbage collection.

-Xincgc 

Enable the incremental garbage collector. The incremental garbage collector, which is off by default, will reduce the occasional long garbage-collection pauses during program execution. The incremental garbage collector will at times execute concurrently with the program and during such times will reduce the processor capacity available to the program.

-Xloggc:file 

Report on each garbage collection event, as with -verbose:gc, but record this data to file. In addition to the information -verbose:gc gives, each reported event will be preceded by the time (in seconds) since the first garbage-collection event. Always use a local file system for storage of this file to avoid stalling the JVM due to network latency. The file may be truncated in the case of a full file system and logging will continue on the truncated file. This option overrides the -verbose:gc option if both are present.

-Xmsn 

Specify the initial size of the memory allocation pool in bytes. The value must be a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 2MB. For example:

      -Xms6291456
      -Xms6144k
      -Xms6m
-Xmxn 

Specify the maximum size of the memory allocation pool in bytes. The value must a multiple of 1024 greater than 2MB. Append k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. For instance:

      -Xmx83880000
        -Xmx8192k
        -Xmx86M
-Xprof 

Profile the running program and send profiling data to standard output. This option is provided as a utility that is useful in program development and should not be used in production.

-Xrunhprof[:help][:<suboption>=<value>,...]

Enable cpu, heap, or monitor profiling. This option is typically followed by a list of comma-separated "<suboption>=<value>" pairs. You can display the list of suboption and their default values by running the command java -Xrunhprof:help.

-Xrs 

Reduce the use of operating-system signals by the Java virtual machine (JVM).

-Xssn 

Set thread stack size.

-XX:+UseAltSigs 

The JVM uses SIGUSR1 and SIGUSR2 by default, which can sometimes conflict with applications that signal-chain SIGUSR1 and SIGUSR2. This option will cause the JVM to use signals other than SIGUSR1 and SIGUSR2 as the default.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.100.202