(Turn) Java Virtual Machine (JVM) parameters configuration instructions

sponsored links
Java Virtual Machine (JVM) parameters configuration instructions

In Java, J2EE large-scale applications, JVM configuration of non-standard parameter is directly related to the overall system performance.
Non-standard JVM is a JVM parameter refers to the bottom of some of the configuration parameters, these parameters can be in the general development of the default, does not require any configuration. However, in a production environment, in order to improve performance, often need to adjust these parameters, in order to achieve the best new system can be.
In addition the configuration of these parameters affect the system stability is also an important factor, I believe the majority of Java developers have all seen the "OutOfMemory" type of error. Oh, it is very possible for them to configure JVM parameters are not configured properly or simply did not realize that configuration.

To illustrate these parameters also need to talk about the JDK in the command-line tools pave the way for some knowledge.

First, look at how to obtain these commands configuration information Note:
Suppose you are a windows platform, you have installed the J2SDK, so now you from the cmd console window into the J2SDK installation directory under the bin directory, and then run the java command, appear the following results, these are the tools and JVM, including java.exe all the commands are inside.

-------------------------------------------------- ---------------------
D: \ j2sdk15 \ bin> java
Usage: java [-options] class [args ...]
(to execute a class)
or java [-options]-jar jarfile [args ...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D <name> = <value>
set a system property
-verbose [: class | gc | jni]
enable verbose output
-version print product version and exit
-version: <value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search |-jre-no-restrict-search
include / exclude user private JREs in the version search
-?-Help print this help message
-X print help on non-standard options
-ea [: <packagename> ...|:< classname>]
-enableassertions [: <packagename> ...|:< classname>]
enable assertions
-da [: <packagename> ...|:< classname>]
-disableassertions [: <packagename> ...|:< classname>]
disable assertions
-esa |-enablesystemassertions
enable system assertions
-dsa |-disablesystemassertions
disable system assertions
-agentlib: <libname> [= <options>]
load native agent library <libname>, eg-agentlib: hprof
see also,-agentlib: jdwp = help and-agentlib: hprof = help
-agentpath: <pathname> [= <options>]
load native agent library by full pathname
-javaagent: <jarpath> [= <options>]
load Java programming language agent, see java.lang.instrument
-------------------------------------------------- ---------------------
In the console output, there is one-X (note the uppercase) command, this is the view the JVM configuration parameters command.

Next, use the java-X command to view the configuration of JVM instructions:
Running the following results, which is to configure JVM parameters, secret weapon, this information is in English, in order to facilitate the reading, I understand according to their own translated into Chinese and the (inaccuracies, were invited to Friends of Fu Zheng Bo)
-------------------------------------------------- ---------------------
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 output cpu profiling data
-Xfuture enable strictest checks, anticipating future default
-Xrs reduce use of OS signals by Java / VM (see documentation)
-Xcheck: jni perform additional checks for JNI functions
-Xshare: off do not attempt to use shared class data
-Xshare: auto use shared class data if possible (default)
-Xshare: on require using shared class data, otherwise fail.

The-X options are non-standard and subject to change without notice.
-------------------------------------------------- ---------------------

JVM configuration parameters in Chinese Description:
-------------------------------------------------- ---------------------
1,-Xmixed mixed mode execution (default)
Mixed-mode implementation of

2,-Xint interpreted mode execution only
Explain the mode

3,-Xbootclasspath: <directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
Set zip / jar resources or class (. Class files) stored directory path

3,-Xbootclasspath / a: <directories and zip/jar files separated by ;>
append to end of bootstrap class path
Additional zip / jar resources or class (. Class files) stored directory path

4,-Xbootclasspath / p: <directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
Pre-loaded zip / jar resources or class (. Class files) stored directory path

5,-Xnoclassgc disable class garbage collection
Close Class garbage collection

6,-Xincgc enable incremental garbage collection
Open the class garbage collection function

7,-Xloggc: <file> log GC status to a file with time stamps
Records of garbage back to the log to a file.

8,-Xbatch disable background compilation
Turn off background compilation

9,-Xms <size> set initial Java heap size
Set JVM heap memory size initialization

10,-Xmx <size> set maximum Java heap size
Set the JVM maximum heap memory size of

11,-Xss <size> set java thread stack size
Set JVM memory size of the stack

12,-Xprof output cpu profiling data
Enter CPU summary table data

13,-Xfuture enable strictest checks, anticipating future default
Implementation of a strict code checks to predict possible scenarios

14,-Xrs reduce use of OS signals by Java / VM (see documentation)
To restore the operating system through the JVM Signal

15,-Xcheck: jni perform additional checks for JNI functions
Checks are performed on the JNI function

16,-Xshare: off do not attempt to use shared class data
As much as possible not to use a shared class data

17,-Xshare: auto use shared class data if possible (default)
As much as possible using shared class data

18,-Xshare: on require using shared class data, otherwise fail.
As much as possible using shared class data, otherwise fail to run

The-X options are non-standard and subject to change without notice.
-------------------------------------------------- ---------------------

This is how to use these parameters do? Actually, all the command line are such a use, the following I will give a simple example to demonstrate the HelloWorl usage of this parameter is very simple.

HelloWorld.java
-----------------------------------------------
public class HelloWorld
(
public static void main (String [] args)
(
System.out.println ( "Hello World!");
)
)

Compile and run:
D: \ j2sdk15 \ bin> javac HelloWorld.java

D: \ j2sdk15 \ bin> java-Xms256M-Xmx512M HelloWorld
Hello World!

Oh, that met under the bar!

Practice: In the large-scale systems or applications to configure JVM parameters to configure your IDE tools such as the parameters are common IDEA, Eclipse, this is specified in a configuration file can be.
If you want to configure the J2EE environment, these parameters, then you need to J2EE application server or Servlet container-related startup parameters at specified, the startup file to configure, Tomcat is catalina.bat configure, weblogic and websphere is in other place, specifically I said, and I believe played these large servers know that not played read this article, play will know, He He.

In addition to the jdk is often asked some of the relevant commands usage, in fact, when you see here, you should know how to get the usage of these commands. If you do not, then I suggest you go to learn DOS, I was a Meizhe. If you will these still did not look to understand, then you quickly learn English bar, so you can read the.

Also: I Finally, several commonly used Java command-line instructions for reference:

(1), javac
Usage: javac <Options "" source files "
Among them, possible options include:
-g generate all debugging information
-g: none does not generate any debugging information
-g: (lines, vars, source) Generate only some debugging information
-nowarn does not generate any warning
-verbose output of the compiler is running the news operation
-deprecation Output using the outdated API, the source location
-classpath <path to "specify the location of the file to find user class
-cp <path to "specify the location of the file to find user class
-sourcepath <Path "specifies the location to find input source files
-bootclasspath <path to "override the location of bootstrap class files
-extdirs <Directory "covers the location of installed extensions directory
-endorseddirs <Directory "the path covered by the location of the standard signature
-d <directory "specify the storage location of the generated class files
-encoding <encoding "specifies the character encoding used by source files
-source <Version "to provide compatibility with the specified version of the source
-target <version of the "build a specific VM version of the class file
-version version information
-help Output a synopsis of standard options
Output of non-standard options-X Summary
-J <flag "directly to" mark "passed to the run-time system

(2), jar
Usage: jar (ctxu) [vfm0Mi] [jar-file] [manifest-file] [-C directory] file name ...
Options:
-c create new archive
-t List archive contents list
-x expand archive named (or all of the files]
-u update existing archive
-v generate verbose output to standard output
-f specify archive file name
-m mark the file that contains information from the identified
-0 Only the storage mode; not use ZIP compression format
-M does not produce a list of all items (manifest] file
-i for the specified jar file index information generated
-C change to the specified directory, and contains the following files:
If a file name is a directory, it will be recursive processing.
List (manifest] file names and archive file names need to be specified, according to 'm' and 'f' flag specified in the same order.

Example 1: The two class files into an archive called 'classes.jar' archive file:
jar cvf classes.jar Foo.class Bar.class
Example 2: Use an existing list (manifest) file 'mymanifest' the foo / directory of all
File archive into a directory called 'classes.jar' archive file:
jar cvfm classes.jar mymanifest-C foo /.

(3), javadoc
javadoc: error - do not specify a package or class.
Usage: javadoc [options] [package name] [source file] [@ file]
-overview <file "to read an overview of the document HTML document
-public Show only public classes and members
-protected Show protected / public classes and members (default)
-package Show package / protected / public classes and members
-private Show all classes and members of the
-help Displays the command-line options and exit
-doclet <class "output is generated through alternative doclet
-docletpath <Path "specifies the location to find doclet class files
-sourcepath <path list "to find the source file location of the designated
-classpath <path list "to find the user specify the location of class files
-exclude <package list "to specify a list of packages to exclude
-subpackages <sub-packages list "to specify recursively into sub-packages
BreakIterator calculate the first-breakiterator using a
-bootclasspath <path list "covered by the bootstrap class loader loaded the
The location of class files
-source <Version "to provide compatibility with the specified version of the source
-extdirs <directory listing "covers the location of installed extensions directory
-verbose output of the Javadoc news operation is being performed
-locale <name "to use the language environment, such as en_US or en_US_WIN
-encoding <name of the "source file encoding name of the
-quiet do not display status messages
-J <flag "directly to" mark "passed to the run-time system

Through the standard doclet provides:
-d <directory "output file destination directory
-use Create class and package usage pages
-version contains the @ version paragraphs
@ author paragraphs-author with
-docfilessubdirs recursive copy the document file subdirectory
-splitindex the index into each letter corresponds to a file
-windowtitle <text "of the document title of the browser window
-doctitle <html Code > contains an overview of the title of the page
-header <html Code > the header of each page contains the text of
-footer <html Code > footer of each page contains the text of
-bottom <html Code > the bottom of each page contains the text
-link <url> create a link to the javadoc output in the <url> links
-linkoffline <url> <url2> the use of software packages in the list of links to <url2> in <url>
Documents
-excludedocfilessubdir <Name 1 ": .. ruled out with the given name of the subdirectories of all document files.
-group <name> <p1>: <p2> .. in the overview page, the specified package group
-nocomment curb descriptions and tags, generate only declarations.
-nodeprecated does not contain @ deprecated information
-noqualifier <Name one ":" Name two >:... excluded from the output list of qualifiers.
-nosince does not include @ since information
-notimestamp does not contain a hidden timestamp
-nodeprecatedlist does not generate a list of obsolete
-notree does not generate class hierarchy
-noindex does not generate an index
-nohelp not generate help link
-nonavbar not generate navigation bar
-serialwarn generates a warning about @ serial tag
-tag <name ":" location ":" title "custom tag specifies a single variable
-taglet to register the fully qualified name of the Taglet
The path-tagletpath Taglet
-charset <character set "for cross-platform view the generated document character set.
-helpfile <file "contains information to help link the links to the file
-linksource in HTML format generated source
-sourcetab <tab length "specifies the source of each space occupied by the number of tabs
-keywords so that package, class and member information with HTML meta tags
-stylesheetfile <path "is used to change the style of the paper document generated
-docencoding <name of the "name of the output coding

(4), rmid
rmid: Illegal option: -?
Usage: rmid <option>

Which, <option> including:
-port <option> designated for the use of the port rmid
-log <directory> specify the directory to write log rmid
-stop stop the current rmid call (on the specified port)
-C <runtime Mark > to pass parameters to each child process (activation group)
-J <runtime Mark > to pass parameters to the java interpreter

There are a lot of work, and on holiday, HOHO, 51 came to write after the bar!
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of (Turn) Java Virtual Machine (JVM) parameters configuration instructions

  • SqlServer database connection pool to connect tomcat

    First, install the JDBC Driver The database driver jar file to put (Tomcat_install) \ common \ lib directory Second, configure the Connection Pool 1. Overall connection pool configuration, Tomcat in any Web application can be configured to use the co ...

  • Unable to load bean: type: struts-derfault.xml abnormal

    Struts2 in the use of a lot of friends from time to time we encountered this anomaly, leading to its main reason is because the wrong package, we have to be xwork-2.1.1.jar and struts2-core-2.1.2.jar, replaced xwork-2.0. 4.jar and struts2-core-2.0.14.jar

  • Software Performance

    1.1 Software Performance In general, the performance is an indicator that the software system or component to its timeliness requirements in line with the level; followed by software performance, are an indicator can be used to measure time. Performa ...

  • Spring jar package Detailed

    AspectJ directory are in the Spring framework to use AspectJ source code and test program files. AspectJ is the first java application framework provided by the AOP. dist directory is a Spring release package, regarding release package described below in

  • EJB ant script to deploy template works

    <? xml version = "1.0" encoding = "UTF-8"?> <! - Name Project name basedir build.xml file directory -> <project name="HelloWorld" basedir="."> <! - Property variables -> <! - The sour ...

  • java read file

    java read documents in two ways: java.io and java.lang.ClassLoader When using the java.io, when java.lang.ClassLoader use it? (Note: If prior to read xml file java read file clearly aware of these two methods have been like! Can take much less to understa

  • Hibernate configuration parameters hibernate.hbm2ddl.auto

    Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...

  • Nan-Jing 5: When IBatis.Hibernate mixed affairs, pay attention to your SQL

    [Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...

  • Learn Java flow

    Related Articles: J2EE without EJB Introducing to Spring Framework (English revised edition) J2EE without EJB caused consider Recommend circles: reading space More related recommend Java Learning Path (1), tools, articles First, JDK (Java Development Kit)

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries