Tag: Temp Otherwise DNA post doc client off SDE operating system
When Java runs a compiled class, it is loaded and executed by a Java virtual machine, and the Java Virtual machine is started by the operating system command Java_home "Bin" java–option,-option is the virtual machine parameter, Java_home is the JDK installation path, These parameters can be used to adjust the running state of the virtual machine, and understand the meaning of the parameters can have a deeper understanding of the operation mode of the virtual machine.
First, view the parameter list:
Virtual machine parameters are divided into basic and extended two categories, the command line input java_home "bin" Java to get the basic parameter list, the command line input java_home "bin" java–x to get the extension parameter list.
Second, the basic parameter description:
1.-client,-server
These two parameters are used to set what mode of operation the virtual machine uses, and client mode is faster to start, but run-time performance and memory management are less efficient than server mode and are typically used for client applications. In contrast, the server mode starts slower than the client, but it can achieve higher operational performance.
On Windows, the default virtual machine type is client mode, and if you want to use server mode, you need to add the-server parameter to get higher performance on server-side applications, especially for multiple CPUs, when you start the virtual machines. The server mode is used by default on Linux.
2.-hotspot
The meaning is the same as the client, JDK1.4 previously used parameters, JDK1.4 Start no longer used, to the client. Replace
3.-CLASSPATH,-CP
When a virtual machine runs a class, it needs to be loaded into memory, and the virtual machine searches for the class in the following way and order:
Bootstrap classes,extension classes,user classes.
The path in Bootstrap is the jar or zip file that the virtual machine comes with, the virtual machine searches for these package files first, and the System.getproperty ("Sun.boot.class.path") to obtain the package name of the virtual machine search.
Extension is a jar file located in the "Lib" ext directory of the JRE, and the virtual machine searches for the jar file under this directory after searching for bootstrap. With System. GetProperty ("Java.ext.dirs") can get the virtual machine to use the extension search path.
The User classes Search order is the current directory, environment variable CLASSPATH,-classpath.
4.-classpath
Tells the virtual machine to search directory names, jar document names, zip document names, separated by semicolons;
For example, when you develop a public class yourself and wrap it in a Common.jar package, you need to use-classpath Common.jar when using classes in Common.jar. Tells the virtual machine to look for the class from Common.jar, or the virtual machine throws a Noclassdeffounderror exception indicating that the class definition was not found.
System.getproperty ("Java.class.path") is available at run time to obtain the path to the virtual machine lookup class.
After using-classpath, the virtual machine will no longer use the class search path in Classpath, and if neither-classpath nor Classpath are set, the virtual machine uses the current path (.). As a class search path.
It is recommended to use-classpath to define the classpath of a virtual confidential search, instead of using the search path of the environment variable CLASSPATH to reduce the potential conflicts that exist when multiple projects are using classpath at the same time. For example, apply 1 to use Class G in A1.0.jar, apply 2 to use Class G in A2.0.jar, A2.0.jar is the A1.0.jar upgrade package, when the A1.0.jar,a2.0.jar in Classpath, the virtual machine search to the first packet of Class G when the search stopped, if the application 1 app 2 of virtual machines are searched from the classpath, there will be an application does not get the correct version of the class G.
5.-d<propertyname>=value
Set the property name/value pair in the system properties of the virtual machine, and the application running on top of this virtual machine can get the value of System.getproperty ("PropertyName").
If there are spaces in value, you need to enclose the value in double quotation marks, such as-dname= "space string".
This parameter is typically used to set system-level global variable values, such as the path to a configuration file, which should be accessible anywhere in the program.
6.-verbose[:class|gc|jni]
Displays the virtual machine run information on the output device.
Verbose and verbose:class have the same meaning, output the information for the class that the virtual machine loads (loads), and the format of the information displayed is as follows:
[Loaded java.io.filepermission$1 from shared objects file]
This parameter can be used to diagnose when the virtual machine reports that the class cannot find or class conflicts when the virtual machine is loaded from the class.
7.-VERBOSE:GC
Displays information in the output device when a memory collection occurs on the virtual machine, in the following format:
[Full GC 268k->168k (1984K), 0.0187390 secs]
This parameter is used to monitor the virtual machine memory recycling situation.
8.-verbose:jni
The output device displays information when the virtual machine calls the native method, in the following format:
[dynamic-linking Native Method Hellonative.sum ... JNI]
This parameter is used to monitor how the virtual machine calls the local method, which facilitates diagnostics in the event of a JNI error.
9.-version
Displays the virtual machine version information that can be run and then exits. When a different version of the JDK is installed on a single machine
10.-showversion
Displays version information and help information. Content from Dedecms
11.-ea[:<packagename>...|:<classname>]
12.-enableassertions[:<packagename>...|:<classname>]
Starting with JDK1.4, Java supports assertion mechanisms for diagnosing run-time problems. The assertion is usually valid during the test phase and does not need to be run when the assertion is formally run. The value of the asserted expression is a logical value, true when the assertion does not run, false when the assertion runs, and throws a Java.lang.AssertionError exception.
The above parameters are used to set whether the virtual machine initiates the assertion mechanism, by default the virtual authority closes the assertion mechanism, with-EA to open the assertion mechanism, run all the assertions in the package and class without <packagename> and classname, if you want to run only some of the assertions in the package or class. The package name or class name can be added after-ea. For example, to start an assertion in package com.foo.util, use the command –ea:com.foo.util.
13.-da[:<packagename>...|:<classname>]
14.-disableassertions[:<packagename>...|:<classname>]
Used to set the virtual machine closed assertion processing mechanism, packagename and classname use the same method and-ea.
15.-esa | -enablesystemassertions
Sets the assertion for the virtual machine display system class.
16.-DSA | -disablesystemassertions
Sets the assertion of the virtual institution's closed system class. Dedecms.com
17.-agentlib:<libname>[=<options>]
This parameter is introduced from JDK5 and is used to mount the local agent library for the virtual machine.
Libname is the local agent library file name, the search path for the virtual machine is the path in the environment variable path, and options is passed to the local library when the parameter is started, and multiple parameters are separated by commas. On the Windows platform, the virtual machine searches for files with local libraries named Libname.dll, the virtual machine on UNIX searches for files with local libraries named libname.so, the search Path environment variables differ on different systems, and the Linux, SunOS, Irix are ld_ Library_path,aix on the Libpath,hp-ux for the Shlib_path.
For example, you can use-agentlib:hprof to get the running of a virtual machine, including the running data of CPU, memory, thread, etc., and output to the specified file, and use-agentlib:hprof=help to get the Help list. The Hprof.dll file can be found in the JRE bin directory.
-agentpath:<pathname>[=<options>]
Set the virtual machine security path to mount the local library and no longer search for paths in path. Other features are the same as agentlib.
19.-javaagent:<jarpath>[=<options>]
The virtual machine starts to fashion into the Java language device proxy. The Mainfest file in the Jarpath file must have the Agent-class attribute. The proxy class wants to implement public static void Premain (String Agentargs, Instrumentation Inst) methods. When the virtual machine is initialized, the Premain method is called in the order in which the proxy class is described.
See also: java.lang.instrument
Third, the extension parameter description
1.-xmixed
Set the-client mode virtual machine to Just-in-time compile and execute in a way that is frequently used, and execute it in an interpreted manner for other methods. This mode is the virtual machine default mode.
2.-xint
Sets the virtual machine running in-client mode to interpret the byte code of the class, without compiling the bytecode into native code.
3.-xbootclasspath:path
4.-xbootclasspath/a:path
5.-xbootclasspath/p:path
Change the virtual machine load default system run package Rt.jar and load the system run class from the search path set in-xbootclasspath. This parameter is not used unless you can write a runtime yourself.
/A: The search path in path is added after the default search path.
/P: Search path in path before the default search path.
6.-XNOCLASSGC
Turn off the garbage collection feature of the virtual machine for class.
7.-XINCGC
Starts the incremental garbage collector, which is turned off by default. An incremental garbage collector can reduce the time to pause caused by accidental garbage collection over a long period of time. However, the incremental garbage collector and the application execute concurrently, thus consuming part of the CPU's functionality on the application.
8.-xloggc:<file>
The information for each garbage collection of the virtual machine is written to the log file, and the file name is specified by the files, which is a flat file with the same contents as the-VERBOSE:GC output.
9.-xbatch
The default way to run a virtual machine is to compile the class code in the background, then execute the code in the foreground, use the-xbatch parameter to turn off the virtual machine background compilation, and then execute after the foreground compilation is complete.
10.-xms<size>
Sets the initial size of the available memory heap for a virtual machine, which is the default unit of bytes, which is an integer multiple of 1024 and is greater than 1MB, which can be set to a large amount of memory in K (k) or M (m). The initial heap size is 2MB.
Example:-xms6400k,-xms256m
11.-xmx<size>
Sets the maximum available size of the virtual machine memory heap, which is the default unit of bytes. The value must be 1024 integer multiples and be greater than 2MB. Use K (k) or M (m) to set the number of large memory units. The default heap maximum value is 64MB.
Example:-xmx81920k,-xmx80m
When the application requests a large memory runtime VM throws Java.lang.OutOfMemoryError:Java heap space error, you need to use-XMX to set media wash eel with eye Axmanovs suo?br>
12.-xss<size>
Sets the size of the line stacks, which is the default unit of bytes. Similar to-XMX, you can also use K or M to set a larger value. The default size of the operating system assigned to line stacks is typically 1MB.
You can also set the size of the stack when you create a thread object in Java, and the constructor prototype is thread (Threadgroup group, Runnable Target, String name, Long stackSize).
13.-xprof
Outputs diagnostic information for CPU runtime.
14.-xfuture
Strict format checking of class files to ensure class code conforms to Class code specification. To maintain backward compatibility, the virtual machine defaults to no strict format checking.
15.-xrs
Reduce the use of operating system signals (Singals) in virtual machines. This parameter is typically used when the virtual machine is running in a later service mode (such as a servlet).
16.-xcheck:jni
first, run the class file
Executes the class file with the main method, with the command behavior:
Java <class file name >
Note: The class file name does not take the file suffix. class
For example:
Java Test
If the class file being executed is a package, it is used in the class file:
Package < pack name >
That should be performed under the base path of the package, the command behavior:
Java < package name;. class file name
For example:
Packagetest.java, its package name is: com.ee2ee.test, the corresponding statement is:
Package com.ee2ee.test;
The storage directory for Packagetest.java and the compiled class file Packagetest.class is as follows:
Classes
|__com
|__ee2ee
|__test
|__packagetest.java
|__packagetest.class
To run Packagetest.class, you should do it under the classes directory:
Java com.ee2ee.test.PackageTest
second, run the class in the jar file
The same principle as running the class file, just add the parameter-cp <jar file name >.
For example: Execute the class com.ee2ee.test.PackageTest in Test.jar and the command line as follows:
JAVA-CP Test.jar Com.ee2ee.test.PackageTest
iii. displaying JDK version information
When there are multiple JDK versions on a single machine, you need to know which version of the JDK is currently in use, use the parameter-version to know its version, and command behavior:
Java-version
Iv. increase the maximum memory that a virtual machine can use
The maximum memory that a Java virtual machine can use is limited, and the default value is usually 64MB or 128MB.
If an application loads the data in memory to improve performance, such as exceeding the default maximum value of 128MB, it needs to increase the maximum memory available to the Java Virtual machine, otherwise an out-of-memory (out-of-system) exception will occur. When you start Java, you need to use the following two parameters:
-xms the size of memory used when initializing a Java virtual machine
-XMX maximum memory that a Java virtual machine can use
The size set in the above two parameters can be taken with a unit, for example: 256m for 256MB
To illustrate:
java-xms128m-xmx256m ...
Indicates that the Java virtual machine is initialized with a memory of 128MB and can use a maximum of 256MB of memory.
For Tomcat, you can modify its script catalina.sh (Unix platform) or Catalina.bat (Windows platform) to set variable java_opts, for example:
Java_opts= '-xms128m-xmx256m ' in the console output information, there is an-X (note is uppercase) command, this is the view JVM configuration parameters of the command.
second, use the Java-x command to view the configuration instructions for the JVM:After running the following results, these are the configuration of the JVM parameters of the secret weapon, the information is in English, in order to facilitate reading, I translated into Chinese according to my own understanding (inaccurate places also please bo friends treatise)-----------------------------------------------------------------------d:\ j2sdk15\bin>java-x -xmixed Mixed mode Execution (default) -xint interpreted mode execution only -xbootclasspath:<directories and Zip/jar files Separated by;> set search path for bootstrap classes and resources - Xbootclasspath/a:<directories and Zip/jar files separated by;> Append to end of bootstrap Class path -xbootclasspath/p:<directories and Zip/jar files separated by;> prepend in front of Bootstrap class path -xnoclassgc Disable class garbage collection -xincgc Enable incremental garbage collection -xloggc:<file> log GC status to a file with time stamps -xbatch Disable Background compilation -xms<size> set initial Java heap size -xmx<size> Set maximum Java heap size -xss<size> Set Java thread stack size -XPROF&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&Nbsp; Output CPU Profiling data -xfuture enable strictest checks, anticipating future default -xrs reduce use of the OS signals by JAVA/VM (see Documentation) -xcheck:jni perform. Additional checks for JNI functions -xshare:off don't attempt to Use shared class data -xshare:auto use shared class data if possible (def Ault) -xshare:on require using shared class data, Otherwise fail. the-x options is non-standard and subject to change without notice.------------------------------- ----------------------------------------&NBSP;JVM Configuration Parameters Chinese Description:-----------------------------------------------------------------------1,-xmixed mixed Mode execution ( Default) Mixed mode execution 2,-xint Interpreted mode execution only interpreting pattern execution 3,-xbootclasspath:<directories and Zip/jar files separated by;> set search path for bootstrap classes and resources sets the directory path for the Zip/jar resource or class (. class file) 3,-xbootclasspath/a:<directories and Zip/jar files separated by;> append to End of Bootstrap class path append Zip/jar resource or Class (. class file) to store directory path 4,-xbootclasspath/p:<directories, and Zip/jar Files separated by;> prepend in front of Bootstrap class path preloaded zip/ The jar resource or class (. class file) holds the directory path 5,-xnoclassgc disable class garbage collection Turn off garbage collection 6,-XINCGC&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBsp Enable incremental garbage collection class garbage collection function 7,-xloggc:<file> log GC status to a File with time stamps logs the garbage back to a file. 8,-xbatch Disable background compilation Turn off background compilation 9,-xms<size> set initial Java heap size Set JVM initialization heap memory size 10,-xmx<size> set maximum Java heap size Set JVM maximum heap memory size 11,-xss<size> set Java thread stack size Set JVM stack memory size 12,-xprof output CPU profiling data Input CPU Profile table data 13,-xfuture enable strictest Checks, anticipating future default performs rigorous code checks, predicts possible scenarios 14,-xrs reduce use of OS siGnals by JAVA/VM (see documentation) Restore operating system signals through the JVM 15,-xcheck:jni Perform. Additional checks for JNI functions performs a check on the JNI function 16,-xshare:off do not Attempt to use shared class data as much as possible without using the data 17,-xshare:auto class data if possible (default) use shared classes as much as possible 18,-xshare:on require Using shared class data, otherwise fail. to use the share classes as much as possible, otherwise the run fails the-x options is non-standard and subject to Chan GE without notice.
Source: http://www.cnblogs.com/z-sm/
Java command line run parameters