Java console application using the operating system console.

I wrote a Java program that when it is executable .jar is opened manually, it is reopened inside the shell console of the operating system. The purpose of this is to have a C # style console application where the user can enter commands, without the user having to manually open the shell console and execute the command. java -jar ... command to open the application.

Would you consider this a good implementation?

Would you make a custom console GUI instead of using the operating system console?

empty main public static (String[] args) {
if (args.length == 0) {// then reopen in the console with an argument to indicate that there is no need to reopen next time.
try {
String os = System.getProperty ("os.name"). ToLowerCase ();
String path = new File (Main.class.getProtectionDomain (). GetCodeSource (). GetLocation (). ToURI ()). GetAbsolutePath ();
if (os.contains ("mac")) {
Chain command = "tell the application " Terminal  " n" +
"do script " java -jar  "# + route +"  & # 39; console  " n" +
"close the front window  n" + // because "do script ..." opens another window
"activate  n" +
"end says";
Runtime.getRuntime (). Exec (new string[]{"osascript", "-e", command});
System.exit (0);
} else if (os.contains ("win")) {
Runtime.getRuntime (). Exec ("cmd / c start cmd.exe / K java -jar " "+ path +"  "console");
System.exit (0);
}
} catch (exception e) {
e.printStackTrace ();
System.exit (0);
}
}
System.out.println ("Enter the command. & # 39; Help & # 39; for the list of commands.");
while (true)
nextCommand ();
}