Unable to load configuration. - [unknown location]要学会切换服务器,当一个环境不行时候,你就切换另外一个,

切换的时候用这个万用小程序用于判断,环境变量是怎么改的,一般是只需呀哦更改一个变量就行了,那就CATALINA_HOME这个环境变量要改为当前使用的tomcat服务器的地址,D:\env\tomcat-6.0.35 

使用哪个服务器就添加那个服务器的路径

public class StartDemo {
	 public static void main (String[] args) {
//	 String start="F://apache-tomcat-7.0.20//bin//startup.bat";
//		String end="F://apache-tomcat-7.0.20//bin//shutdown.bat";
//	   excuteCommand(end);
//          excuteCommand(start);		 
		 excuteCommand("sc stop HIKCMS");
		 excuteCommand("sc start HIKCMS");	 
//	
	 }	    
	    public static void  excuteCommand(String command)
	    {
	            try {
	            	 Process  p =  Runtime.getRuntime().exec(command);
	                BufferedReader br = new BufferedReader(new InputStreamReader(p
	                        .getInputStream()));
	                String inline;
	                while ((inline = br.readLine()) != null) {
	                    System.out.println(inline);     
	                }
	                br.close();
	            } catch (IOException e) {
	                // TODO Auto-generated catch block
	                e.printStackTrace();
	            }

	    }
	}

下面的程序用于判断是否能打开一个网页

public class wangye {
		 public static Boolean login(){
		 boolean flag = false; 
		  Runtime rt = Runtime.getRuntime(); 
		  try { 
		  rt.exec("rundll32   url.dll,FileProtocolHandler   " + "http://localhost:8080/"); 
		  } catch (IOException e) { 
		  }
       return flag;
		 }
		 public static void main(String[] args) {
			 Boolean flag= login( );
			 if(flag){
	 System.out.println("TOMCAT已经启动");  
			 }else{
				 System.out.println("TOMCAT已经启动");   			 
			 }			 
		 }
		}


你可能感兴趣的:(Unable to load configuration. - [unknown location]要学会切换服务器,当一个环境不行时候,你就切换另外一个,)