Java 程序命令行参数说明

启动Java程序的方式有两种:

# starts a Java virtual machine, loads the specified class, and invokes that class's main method
java [options] class [arguments]
# starts a Java virtual machine with a JAR file, which should contain a "Main-Class" attribute in the manifest file.
# The "Main-Class" attribute defines the Java class to be launched
java [options] -jar file [arguments]

Java 的标准参数

C:\Users\Mil>java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a -bit data model if available
-d64 use a -bit data model if available
-server to select the "server" VM, the default VM is server. -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. 在linux下这个符号是 :
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed in a future release. require the specified version to run
-showversion print product version and continue (运行前输出版本信息)
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed in a future release. 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 with specified granularity 启用断言
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -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
-splash:<imagepath>
show splash screen with specified image

关于-d32和-d64参数, 参考 http://www.oracle.com/technetwork/java/hotspotfaq-138619.html

The options -d32 and -d64 have been added to the Java launcher to specify whether the program is to be run in a 32 or 64-bit environment. On Solaris these correspond to the ILP32 and LP64 data models, respectively.  Since Solaris has both a 32 and 64-bit J2SE implementation contained within the same installation of Java, you can specify either version.  If neither -d32 nor -d64 is specified, the default is to run in a 32-bit environment.  
Other Java commands (javac, javadoc, etc.) will rarely need to be executed in a 64-bit environment. However, the -d32/-d64 options may be passed to these commands and then on to the Java launcher using the established -J prefix option (eg: -J-d64).  
All other platforms (Windows and Linux) contain separate 32 and 64-bit installation packages.  If both packages are installed on a system, you select one or the other by adding the appropriate "bin" directory to your path.  For consistency, the Java implementations on Linux accept the -d64 option.

Oracle Java 8 的扩展参数

C:\Users\M>java -X
-Xmixed mixed mode execution (default) 设置-client模式虚拟机对使用频率高的方式进行 Just-In-Time 编译和执行,对其他方法使用解释方式执行
-Xint interpreted mode execution only 设置-client模式下运行的虚拟机以解释方式执行类的字节码,不将字节码编译为本机码
-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
-Xdiag show additional diagnostic messages
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection 启动增量垃圾收集器,缺省是关闭的。增量垃圾收集器能减少偶然发生的长时间的垃圾回收造成的暂停时间。但增量垃圾收集器和应用程序并发执行,因此会占用部分CPU
-Xloggc:<file> log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms<size> set initial Java heap size 设置虚拟机可用内存堆的初始大小,缺省单位为字节,该大小为 的整数倍并且要大于1MB,可用 k(K)或m(M)为单位来设置较大的内存数。初始堆大小为 2MB
-Xmx<size> set maximum Java heap size 设置虚拟机内存堆的最大可用大小,缺省单位为字节。该值必须为 整数倍,并且要大于 2MB。可用 k(K)或 m(M)为单位来设置较大的内存数。缺省堆最大值为 64MB
-Xss<size> set java thread stack size 设置线程栈的大小,缺省单位为字节。与-Xmx 类似,也可用 K 或 M 来设置较大的值。通常操作系统分配给线程栈的缺省大小为 1MB
-Xprof output cpu profiling data 输出 CPU 运行时的诊断信息
-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.
-XshowSettings show all settings and continue
-XshowSettings:all
show all settings and continue
-XshowSettings:vm show all vm related settings and continue
-XshowSettings:properties
show all property settings and continue
-XshowSettings:locale
show all locale related settings and continue The -X options are non-standard and subject to change without notice.

Java命令行的执行参数的更多相关文章

  1. java 命令行制定logback参数

    -Dlogback.configurationFile=file:///export/Workspace/apache-cassandra/apache-cassandra-main/target/b ...

  2. java命令行编译执行

  3. Java - Java 命令行简介: 选项, 属性, 参数

    概述 简单介绍一下 java 命令行相关的参数及属性 1. java 命令行 基本 命令 > java <mainClass> 描述 执行 Java 类 需要准备好编译完成的 mai ...

  4. Java 命令行 编译、执行、打包

    Java 命令行 编译.执行.打包 一般来说 IDE 能够很方便的编译打包. 我写这篇文章是遇到了不能使用 IDE 的情况,简单记录一下,不做深入探讨. 环境 linux jdk 1.8 简单的编译执 ...

  5. java命令行从编译到打jar包到执行

     目录: 一. javac编译     1. 没有额外的jar包     2. 包含额外的jar包 二. jar打jar包 三. java运行     1. java命令执行     2. jar包执 ...

  6. java命令行输入参数

    Java命令行输入参数 代码用例:命令行输入参数,并进行加法运算. public class Demo01 { public static void main(String[] args) { for ...

  7. php从命令行中接收参数

    php一直都是作为服务器编程的主要角色,其实php也可已做脚本,比如从命令行中接收一些参数,下面就简单介绍一下如何从命令行中接收参数 代码如下: <?php var_dump($argv); ? ...

  8. Java 命令行编译项目

    如果是用Exlipse, 第三方的包可以放在eclipse文件夹的jre包的lib文件夹中! (初学者的一些总结-高手们勿喷哈-) 原因: 以前一直用Eclispe编程环境运行Java.非常舒服,就像 ...

  9. MySQL命令行下执行.sql脚本详解

    本文主要介绍一个在MySQL命令行下执行脚本文件的例子,通过这个例子让我们来了解一下在命令行下MySQL是怎样执行脚本的吧.现在我们开始介绍这一过程. 1.首先编写sql脚本,保存为的:book.sq ...

随机推荐

  1. 如何处理Android Studio 上面关于 update 和 commit 小箭头的消失

    问题: android studio 在关联 SVN 或者 git 服务后,会在工具栏出现 update 和 commit 小箭头 如图: 但是,有时你打开工程的时候,发现这两个小箭头却消失不见了 如 ...

  2. Android Launcher 3 简单分析

    最近在学习Android Launcher的相关知识,在github上找到可以在Android studio上编译的Launcher 3代码,地址:https://github.com/rydanli ...

  3. Android 多媒体播放API简介

    本文调用android的媒体播放器实现一些音乐播放操作 项目布局: <LinearLayout xmlns:android="http://schemas.android.com/ap ...

  4. yii2搭建完美后台并实现rbac权限控制案例教程

    作者:白狼 出处:www.manks.top/article/yii2_frame_rbac_template 本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连 ...

  5. get set 中 快捷键生成的get方法中 renturn 没有 this.对象 中的this 解决方法

    选EDIT  进行修改

  6. jQuery中find和filter的区别

    本文来自:http://blog.csdn.net/woshixuye/article/details/7255260 这是jQuery里常用的2个方法. 他们2者功能是完全不同的,而初学者往往会被误 ...

  7. 编写Java应用程序。首先,定义描述学生的类——Student,包括学号(int)、 姓名(String)、年龄(int)等属性;二个方法:Student(int stuNo,String name,int age) 用于对对象的初始化,outPut()用于输出学生信息。其次,再定义一个主类—— TestClass,在主类的main方法中创建多个Student类的对象,使用这些对象来测 试Stud

    package zuoye; public class student { int age; String name; int stuNO; void outPut() { System.out.pr ...

  8. SQL Server 2008 R2——创建函数 筛选出字符串中的数字 筛选出字符串中的非数字

    =================================版权声明================================= 版权声明:本文为博主原创文章 未经许可不得转载  请通过右 ...

  9. python基础(四)运算

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! Python的运算符和其他语言类似 (我们暂时只了解这些运算符的基本用法,方便我们 ...

  10. Linux小技巧总结

    1.fdisk创建磁盘分区不重启系统partprobe 使用fdisk工具只是将分区信息写到磁盘,如果需要mkfs磁盘分区则需要重启系统才能够读取到/dev/sda*,而使用partprobe则可以使 ...