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. Protocol and Delegate协议和代理

    1.什么是协议?  OC协议仿照Java的接口.协议和接口,都是不同类的对象之间一种通信的机制.2.协议的基础语法  单纯的语言描述协议的语法,很难让人理解,主要因为在OC中协议是类对象的通信机制,他 ...

  2. 用于主题检测的临时日志(9ef9ede0-46b6-438d-8fb4-ba6b911a34fa - 3bfe001a-32de-4114-a6b4-4005b770f6d7)

    这是一个未删除的临时日志.请手动删除它.(258a3e7d-420b-4c9f-bba2-e0ee0f0f198b - 3bfe001a-32de-4114-a6b4-4005b770f6d7)

  3. nginx 的信号控制概述

    <nginx 在ubuntu 上的启动,停止,重启>中的停止和重启命令基本都是用信号来控制的.这是一些简单的信号控制. 在Nginx服务器中,通常情况都是通过对其发送控制信号进行控制的,除 ...

  4. laravel excel迁移到lumen

    1.简介 Laravel Excel 在 Laravel 5 中集成 PHPOffice 套件中的 PHPExcel ,从而方便我们以优雅的.富有表现力的代码实现Excel/CSV文件的导入和 导出  ...

  5. android Activity生命周期(设备旋转、数据恢复等)与启动模式

    1.Activity生命周期     接下来将介绍 Android Activity(四大组件之一) 的生命周期, 包含运行.暂停和停止三种状态,onCreate.onStart.onResume.o ...

  6. [20140117]疑似checkpoint堵塞数据库连接

    注:这个说法是不成立的,问题已经解决,但是无法正确的定位到具体什么原因:[20140702]奇怪的应用程序超时 背景: 开发通过应用程序的日志发现间歇性的出现,数据库连接超时 原因: 只能大概猜测,没 ...

  7. Servlet/JSP-08 EL表达式

    EL - Expression Language 一. 基本语法 EL表达式以 ${} 的形式访问变量的值 1. "." 和 "[]" 运算符 <%@ p ...

  8. jasper 常用知识点总结

    1.应用: 列头 "YYYY-MM" 格式转化为 "MM YYYY"格式, eg : Date1 = 2014-11 new java.text.SimpleD ...

  9. ES6函数剩余参数(Rest Parameters)

    我们知道JS函数内部有个arguments对象,可以拿到全部实参.现在ES6给我们带来了一个新的对象,可以拿到除开始参数外的参数,即剩余参数(废话好多 O(∩_∩)O~). 这个新的对象和argume ...

  10. 发现struct proc_dir_entry内核3.10.17移到internal中去了,倒

    struct proc_dir_entry 原:2.6.38.8 在#include <linux/proc_fs.h> 现:3.10.17 在fs/proc/internal.h:str ...