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

怎么通过配置文件 控制代码 切换方法

2012-01-15 
如何通过配置文件 控制代码 切换方法[codeJava][/code]try {lblTextShowInfo.setForeground(Display.getC

如何通过配置文件 控制代码 切换方法
[code=Java][/code]try {
lblTextShowInfo.setForeground(Display.getCurrent()
.getSystemColor(SWT.COLOR_DARK_YELLOW));
lblTextShowInfo.setText("正在执行立即解析,请稍后...", false);

// 正式环境
//handExecute();
// 测试环境
performTemp();
if (result == IPlatformRunnable.EXIT_RESTART) {
return;
}
showSendReceInfo();

lblTextShowInfo.setForeground(Display.getCurrent()
.getSystemColor(SWT.COLOR_DARK_GREEN));
lblTextShowInfo.setText("执行完手动操作,接收情况见于下面文本框!", false);
}

开发的RCP,CS结构, 想用配置文件控制 正式环境 和 测试环境, 现在只能用编译后的class 来区分两个环境,配置文件该怎么写 没有思路

[解决办法]
不是吧,
写个配置文件config.properties;
内容
#test, release
environment=release
Properties prop = new Properties();
prop.load(new FileInputStream( "config.properties "));

String env = prop.getProperties( "environment ");

if( "release ".equals(env)) {
}
else if( "test ".equals(env)) {
}

热点排行