专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Eclipse

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

发布时间:2010-06-05 15:34:38 文章来源:www.iduyao.cn 采编人员:星星草
如何通过配置文件 控制代码 切换方法
[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)) {
}
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: