Java命令行的执行参数
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命令行的执行参数的更多相关文章
- java 命令行制定logback参数
-Dlogback.configurationFile=file:///export/Workspace/apache-cassandra/apache-cassandra-main/target/b ...
- java命令行编译执行
- Java - Java 命令行简介: 选项, 属性, 参数
概述 简单介绍一下 java 命令行相关的参数及属性 1. java 命令行 基本 命令 > java <mainClass> 描述 执行 Java 类 需要准备好编译完成的 mai ...
- Java 命令行 编译、执行、打包
Java 命令行 编译.执行.打包 一般来说 IDE 能够很方便的编译打包. 我写这篇文章是遇到了不能使用 IDE 的情况,简单记录一下,不做深入探讨. 环境 linux jdk 1.8 简单的编译执 ...
- java命令行从编译到打jar包到执行
目录: 一. javac编译 1. 没有额外的jar包 2. 包含额外的jar包 二. jar打jar包 三. java运行 1. java命令执行 2. jar包执 ...
- java命令行输入参数
Java命令行输入参数 代码用例:命令行输入参数,并进行加法运算. public class Demo01 { public static void main(String[] args) { for ...
- php从命令行中接收参数
php一直都是作为服务器编程的主要角色,其实php也可已做脚本,比如从命令行中接收一些参数,下面就简单介绍一下如何从命令行中接收参数 代码如下: <?php var_dump($argv); ? ...
- Java 命令行编译项目
如果是用Exlipse, 第三方的包可以放在eclipse文件夹的jre包的lib文件夹中! (初学者的一些总结-高手们勿喷哈-) 原因: 以前一直用Eclispe编程环境运行Java.非常舒服,就像 ...
- MySQL命令行下执行.sql脚本详解
本文主要介绍一个在MySQL命令行下执行脚本文件的例子,通过这个例子让我们来了解一下在命令行下MySQL是怎样执行脚本的吧.现在我们开始介绍这一过程. 1.首先编写sql脚本,保存为的:book.sq ...
随机推荐
- Java中并发问题整理
1. java中有几种方法可以实现一个线程? 使用Runnable,Callable,Thread或者线程池 2. 如何停止一个正在运行的线程? 可以使用正在运行的线程,支持线程中断,通常是定义一个v ...
- PHP操作mysql数据库:[2]查询数据听语音
本文主要详细讲解如何使用php语言,对mysql数据库进行查询.添加.删除.更新等操作. 工具/原料 Macromedia Dreamweaver 8 mysql数据库,php语言 一.前言 ...
- github代码上传之命令提交
Git GUI的用法比较简单,随便弄弄就可以将本地git库中的代码提交到远端github服务器,所以想把Git bash这玩意儿的操作流程快速过一遍,主要是做个笔记,以后忘记了可以看看怎么操作的. 首 ...
- jsoup解析HTML及简单实例
jsoup 中文参考文献 http://www.open-open.com/jsoup/ 本文将利用jsoup,简单实现网络抓取的功能,并给出一个小实例,该实例效果为:获取作者本人在博客园写的所 ...
- oracle基础知识
-- 表 create table test (names varchar2(12), dates date, num ...
- SQL Server 2000:提示“未与信任SQL SERVER连接相关连”错误
在使用“用户模式”登陆SQL Server 2000时提示“未与信任SQL SERVER连接相关连”错误,因为在安装SQL Server时选择“仅Windows”模式,所以所有用户都不可以登陆. 解决 ...
- H264解码学习-2015.04.16
今天看了不少,却感觉收获寥寥. 1.H264相关知识 因为RTP协议发过来的数据已经经过了H264编码,所以这边需要解码.补充一下H264的相关知识. 与以往的视频压缩标准相比,H.264 视频压缩标 ...
- mysql set names 命令和 mysql 字符编码问题
先看下面的执行结果: (root@localhost)[(none)]mysql>show variables like 'character%'; +--------------------- ...
- 使用SQL检测死锁
第一步:首先创建两个测试表,表goods_sort和goods 表goods_sort:创建并写入测试数据 IF EXISTS(SELECT name FROM sysobjects WHERE na ...
- mongodb的备份
转载请附原文链接:http://www.cnblogs.com/wingsless/p/5672057.html mongodb现在为止还是没有像XtraBackup这样好用的备份工具,因此一般来说会 ...