-------------------- 对于如何给自己写的main传递参数,java用args[] 数组来解决。下面我给出自己的方法:
cmd 如下:
java -DmyParam1=hello,world com.test.Test
class 类如下:
package com.test;
public class Test{
public static void main(String[] args){
System.out.println(System.getProperty("myParam1"));
// output: hello,world
}
}
这样就省去了自己解析参数的部分。下面的说明,更详细的说明了这点。
-------------------- 下面列出了 JAVA 自身运行需要的一些必要参数
-D set a system property(设置系统属性)
可通过语句System.getProperties().list(System.out);查看有哪些参数可以设置。
可设置的参数:
-- listing properties --
java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
sun.boot.library.path=C:\Program Files\Java\jre1.5.0_08\bin
java.vm.version=1.5.0_08-b03
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.country=CN
sun.os.patch.level=Service Pack 2
java.vm.specification.name=Java Virtual Machine Specification
user.dir=D:\wapSearchLogService
java.runtime.version=1.5.0_08-b03
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files\Java\jre1.5.0_08\lib...
os.arch=x86
java.io.tmpdir=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\
line.separator=
java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows XP
sun.jnu.encoding=GBK
java.library.path=C:\Program Files\Java\jre1.5.0_08\bin...
java.specification.name=Java Platform API Specification
java.class.version=49.0
sun.management.compiler=HotSpot Client Compiler
os.version=5.1
user.home=C:\Documents and Settings\Administrator
user.timezone=Asia/Shanghai
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=GBK
java.specification.version=1.5
user.name=Administrator
java.class.path=D:\wapSearchLogService\bin;D:\wapSear...
java.vm.specification.version=1.0
sun.arch.data.model=32
java.home=C:\Program Files\Java\jre1.5.0_08
java.specification.vendor=Sun Microsystems Inc.
user.language=zh
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode, sharing
java.version=1.5.0_08
java.ext.dirs=C:\Program Files\Java\jre1.5.0_08\lib...
sun.boot.class.path=C:\Program Files\Java\jre1.5.0_08\lib...
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.desktop=windows
sun.cpu.isalist=amd64
这样就可以在java中通过System.getProperty(“propertyName”) 获得环境变量设置的值
---------------------------------- 参考 ------------------
其他的java的运行参数:
相关推荐
计算机网络中端到端论点的经典论文 作者:J.H. Saltzer, D.P. Reed and D.D. Clark M.I.T. Laboratory for Computer Science
关于网络中端到端设计的一篇很好的论文~~~大家可以轻松获得
04-Variadic Arguments.rar
06-函数的arguments参数.html
前端开源库-arguments-extended参数扩展,用于处理参数对象的实用程序
您可以通过调用exec:java目标并为exec.mainClass和.exec.arguments属性传递适当的值来运行任何示例,例如: ObjectStorageGetBucketExample类需要3个参数,分别是隔离专区的OCID,存储区名称,对象名称。...
java -cp target/marshalsec-0.0.1-SNAPSHOT-all.jar marshalsec.<Marshaller> [-a] [-v] [-t] [<gadget_type> [<arguments...>]] 参数说明: -a:生成exploit下的所有payload(例如:hessian下的...
资源来自pypi官网。 资源全名:flake8-force-keyword-arguments-1.0.2.tar.gz
网络组成原理经典论文阅读报告,这篇论文提出了一个分布式计算机系统功能连接的端到端设计原则。作者提出,在底层的网络传输系统中进行复杂的工作将会使得整个系统效率低下。不如让底层网络传输只专心进行数据传输,...
We provide a zero-knowledge argument for arithmetic circuit satisfiability with a communication complexity that grows logarithmically in the size of the circuit. The round complexity is also ...
validate-arguments-js 验证参数,声明性的。安装 npm install validate-arguments 代码本身取决于lodash ,并且可以使用require.js在浏览器中require.js 。文献资料该模块lodash一些验证方法,但是通过为您提供了...
js代码-Generator arguments ex
log ( fixture ( 1 , 2 , 3 , { foo : 'bar' } ) )//=> [ 1, 2, 3, { foo: 'bar' } ]也可以看看 :功能齐全的 Promises/A+ 实现,性能非常好 : 处理给定的 Arguments 对象 - 单独返回最后一个参数(通常是回调)和...
Prerequisites: Java VM 1.8 Open a command shell/window, browse to where you ...Using the --help option will show the allowed command line arguments. 更多查看: https://github.com/WebGoat/WebGoat
混合参数 函数参数多路复用器。 安装 $ npm install mux-arguments 用法 const mux = require ( 'mux-arguments' ) function muxDemux ( arg1 , arg2 , arg3 ) { mux ( obj => { arguments . length === 1 // ...
The macro QCOMPARE verifies that the two objects passed as arguments are identical and displays the value of these two objects, which facilitates debugging. QCOMPARE macro is quite strict, in way ...
移位参数 移动 javascript 函数参数以更好地与不同框架集成 npm install shift-arguments用法删除参数 var shiftArguments = require('shift-arguments');function testFunc (result) {}function doSthAsync ...
命令行解析系统。 通过Java Reflection,它允许简单的用法。 键被定义为标准的、可重载的方法,并由引擎透明地管理。 无需使用库定义的对象或枚举。 开发商有实力!