如题。
我有一个程序,在dos启动Tomcat(监视程序执行情况)的时候,运行正常。但是一旦我让它作为Windows服务自动启动,就不运行了。很奇怪。然而我必须让它最终作为服务自动运行
系统是tomcat6.0,Windowsxp
action里就调用一个方法
public ActionForward dododo(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
ShowLocal.show();
return null;
}
ShowLocal.show()就是打开一个本地文件
public class ShowLocal {
public static void show(){
Desktop desktop=Desktop.getDesktop();
File file=new File("c:\Program Files\pion","1.html");
System.out.println("我草!");
if(!file.exists()){
System.out.println("file不存在");
}else{
try {
desktop.open(file);
System.out.println(file.getAbsolutePath());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
System.out.println("我草!");
}
在日志里两个“我草”都能打印。路径输出的也没错。 就是不能打开那个本地文件。。。。
哎。。。但是有那个dos对话框就能成功。。。。 为啥啊。