import java.io.File;
import java.io.OutputStream;

public class Start {
    private static Process process;
    private static OutputStream output;
	private static boolean restart = true;

    public static void main(String args[]) {
        if (args.length != 2) {
            System.out.println("Two Arguments needed, first command, second path");
            return;
        }

        Runtime.getRuntime().addShutdownHook(new Thread() { // get the signal to stop the process
            @Override
            public void run() {
                try {
					restart = false; // stop the endless loop for restarting the server
                    output.write(new byte[] {(byte)0x73,(byte)0x74,(byte)0x6f,(byte)0x70,(byte)0x0d,(byte)0x0a}); // The byte-array represents "stop" and a return char
					output.flush(); // write the buffer to the process
					process.waitFor(); // wait for the server-stop
					Runtime.getRuntime().halt(0); // retrun 0 so the process end is succsessfull
                } catch (Exception ex) {
                    System.out.println("Stop Failed: " + ex.getMessage());
                }
            }
        });

		while (restart) {
			try {
				process = Runtime.getRuntime().exec(args[0], null, new File(args[1])); // init the process
				output = process.getOutputStream(); // get the output-stream to write commands to the process
				process.waitFor(); // wait for server-stop
			} catch (Exception ex) {
				System.out.println("Execution Failed: " + ex.getMessage());
			}
		}
    }
}
@@ -141,17 +141,20 @@
 output;%0A
-%09
+    
 private 
@@ -551,21 +551,36 @@
   try %7B%0A
-%09%09%09%09%09
+                    
 restart 
@@ -686,71 +686,81 @@
 te%5B%5D
- 
 %7B(byte)
+ 
 0x73,
+ 
 (byte)
+ 
 0x74,
+ 
 (byte)
+ 
 0x6f,
+ 
 (byte)
+ 
 0x70,
+ 
 (byte)
+ 
 0x0d,
+ 
 (byte)
+ 
 0x0a
@@ -817,21 +817,36 @@
 rn char%0A
-%09%09%09%09%09
+                    
 output.f
@@ -888,21 +888,36 @@
 process%0A
-%09%09%09%09%09
+                    
 process.
@@ -959,13 +959,28 @@
 top%0A
-%09%09%09%09%09
+                    
 Runt
@@ -1213,18 +1213,24 @@
    %7D);%0A%0A
-%09%09
+        
 while (r
@@ -1243,89 +1243,253 @@
 ) %7B%0A
-%09%09%09try %7B%0A%09%09%09%09process = Runtime.getRuntime().exec(args%5B0%5D, null, new File(args%5B1%5D)
+            try %7B%0A                ProcessBuilder pb = new ProcessBuilder(args%5B0%5D);%0A                pb = pb.directory(new File(args%5B1%5D));%0A                pb = pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);%0A                process = pb.start(
 ); /
@@ -1507,20 +1507,32 @@
 process%0A
-%09%09%09%09
+                
 output =
@@ -1617,20 +1617,32 @@
 process%0A
-%09%09%09%09
+                
 process.
@@ -1676,19 +1676,28 @@
 er-stop%0A
-%09%09%09
+            
 %7D catch 
@@ -1717,12 +1717,24 @@
 ) %7B%0A
-%09%09%09%09
+                
 Syst
@@ -1793,15 +1793,30 @@
 ));%0A
-%09%09%09%7D%0A%09%09
+            %7D%0A        
 %7D%0A  

Change to ProcessBuilder