第一种 Program arguments
命令行中写入 main中的args读出
第二种System property
VM arguments -D写入 或者程序中System.setProperty写入
System.getProperty读出
第三种 操作系统环境变量
shell中set写入
System.getEnv()读出
参考
http://blog.csdn.net/bbirdsky/article/details/8136310
http://www.avajava.com/tutorials/lessons/how-do-i-set-system-properties.html?page=1