1 package webman.stager; 2 3 import java.io.*; 4 5 23 public class SiteReceiverLauncher 24 { 25 30 public static void main(String [] args) 31 { 32 try 33 { 34 String javaHome = System.getProperty("java.home"); 36 String javaProg = javaHome + File.separator + "bin" + File.separator + "java"; 37 String javaClasspath = System.getProperty("java.class.path"); 38 String [] newArgs = new String [args.length + 4]; 39 newArgs[0] = javaProg; 40 newArgs[1] ="-classpath"; 41 newArgs[2] = javaClasspath; 42 newArgs[3] = "webman.stager.SiteReceiver"; 43 for ( int x=0; x<args.length; x++ ) newArgs[x+4] = args[x]; 44 Process proc = Runtime.getRuntime().exec(newArgs); 46 BufferedReader inReader = new BufferedReader(new InputStreamReader(proc.getInputStream())); 47 String line; 49 while ((line = inReader.readLine()) != null) 50 { 51 System.out.println(line); 52 System.out.flush(); 53 if ( line.indexOf("end of http output") > -1 ) { System.exit(0); 56 } 57 } 58 } 59 catch (Exception e) 60 { 61 e.printStackTrace(); 62 } 63 } 64 } | Popular Tags |