Web开发中为了用户的方便,时常要在项目中提供帮用户调调用本机系统命令的一些功能,如:打开IE或者Outlook等。现记录下来,以备大家后用。
public
static
void main(String[] args) {
try {
//java调用ie
Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler http://yangfei520.blog.51cto.com/");
//java调用outllok
//Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler mailto:yangfei_luck@163.com?subject=&body=");
} catch (IOException e) {
e.printStackTrace();
}
}
try {
//java调用ie
Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler http://yangfei520.blog.51cto.com/");
//java调用outllok
//Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler mailto:yangfei_luck@163.com?subject=&body=");
} catch (IOException e) {
e.printStackTrace();
}
}
本文转自NightWolves 51CTO博客,原文链接:
http://blog.51cto.com/yangfei520/489779
,如需转载请自行联系原作者