try Runtime getRuntime exec Main currentPath substring Main currentPat

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
try {
Runtime.getRuntime().exec("\"" + "./" + Main.currentPath.substring(1, Main.currentPath.length()) + "/GTR_Start_" + Main.selected + ".sh" + "\"");
System.out.println("\"" + "./" + Main.currentPath.substring(1, Main.currentPath.length()) + "GTR_Start_Hard_" + Main.selected + ".sh" + "\"");
} catch (IOException e2) {
e2.printStackTrace();
}
} else {
if(checkBox.isSelected()){
fh.writeToFile(Main.currentPath + "GTR_Start_"+ Main.selected +".bat", "@echo off\n chcp 1251\n" + exec+ "\nexit");
} else {
fh.writeToFile(Main.currentPath + "GTR_Start_"+ Main.selected +".bat", "chcp 1251\n" + exec+ "\nexit");
}
try {
if(checkBox.isSelected()){
Runtime.getRuntime().exec("cmd /c cd " + Main.currentPath.substring(1, Main.currentPath.length()) + "& start /b GTR_Start_" + Main.selected + ".bat");
} else {
Runtime.getRuntime().exec("cmd /c cd " + Main.currentPath.substring(1, Main.currentPath.length()) + "& start GTR_Start_" + Main.selected + ".bat");
}
} catch (IOException e1) {
e1.printStackTrace();
}