Java Command line parameter description learning

Source: Internet
Author: User
Tags bootstrap classes class definition

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. Server mode is used by default on Linux,solaris.

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 Java.lang.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 configuration file paths, which should be accessible anywhere in the program.

Here are a lot of parameters http://xinklabi.iteye.com/blog/837435

Java Command line parameter description learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.