I'm trying to make a Jar file which runs a main class that opens a new terminal window and run other class from inside that Jar.
I saw this discussion "How do I make my java application open a console/terminal window?" and Brandon Barajas' answer was exactly what I was looking for, but only for windows. I know how to make the system detection but I can't make the program do the same for mac and linux. Can somebody (maybe Brandon) help me?
EDIT:
I was able to make it work in linux using this command Runtime.getRuntime().exec(new String[]{"/usr/bin/xterm","-e","java -Dfile.encoding=UTF8 -jar \"" + "/" + filename + "\""+"; bash"});
to open xterm and issue the command, but I still don't know how to make it work for mac terminal.
EDIT 2:
Now I can open mac terminal using
Runtime.getRuntime().exec("/usr/bin/open -a Terminal /usr/bin/java");
but it still won't accept arguments to run my program. It only opens terminal, run java and exit. If i try using
Runtime.getRuntime().exec("/usr/bin/open -a Terminal /usr/bin/java -jar" + filename);
it does nothing.