Using Java to open a mac application from terminal
===

Lets say I have this code


import java.io.IOException;



public class Test
{

	 public static void main(String[] argv) throws InterruptedException, IOException {
		String path = /an app with spaces.app
		path = path.replaceAll(" ", "\\\\ ");
		System.out.println(path);
		Runtime.getRuntime().exec( new String[] { "open", path} );
		 Runtime.getRuntime().exec("syslog -s -l " + path);
	 }
	

  

}

The thing is when I output the path in print and try the command in terminal, it opens the application, but when I try to execute the command from Java, it just closes, maybe it is an issue with escaping backslashes? Thanks. Everything I want to do is open an app with spaces in its name, using terminal or not.