-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartup.java
More file actions
15 lines (15 loc) · 777 Bytes
/
Startup.java
File metadata and controls
15 lines (15 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import java.io.*;
import java.awt.GraphicsEnvironment;
import java.net.URISyntaxException;
public class Startup{
public static void main (String [] args) throws IOException, InterruptedException, URISyntaxException{
Console console = System.console();
if(console == null && !GraphicsEnvironment.isHeadless()){
String filename = TextAdventureTestDemo.class.getProtectionDomain().getCodeSource().getLocation().toString().substring(6);
Runtime.getRuntime().exec(new String[]{"cmd","/c","start","cmd","/k","java -jar \"" + filename + "\""});
}else{
TextAdventureTestDemo.main(new String[0]);
System.out.println("Program has ended, please type 'exit' to close the console");
}
}
}