首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

Eclipse中运作参数设置

2012-12-28 
Eclipse中运行参数设置在cmd上执行java类的命令格式是:用法: java [-options] class [args...]eclipse的ru

Eclipse中运行参数设置
在cmd上执行java类的命令格式是:
用法: java [-options] class [args...]

eclipse的run configration中有两种参数:
Program arguments: 用来传进main中的args
VM arguments: 相当于java options

代码:

public static void main(String[] args) throws Exception { System.out.println(System.getProperty("appHome")); System.out.println(args[0]); System.out.println(args[1]); }


运行设置:
Program arguments:name value
VM arguments:-DappHome=D:\test\
(注:  -D<name>=<value>是设置系统属性)

输出:
D:\test\
name
value



热点排行