Got a bit of an issue that I can't seem to find online..
Basically I'm writing a java program that is essentially a GUI to start stop minecraft server instances. Sounds OTT but it's fun so whatever.
I've ran into an issue whereby I could not get java to run a batch file, so I converted it to exe to make it easier. The exe runs fine if you double click it, it runs fine if you call it from cmd but when testing (I'm coding in Eclipse) just.. nothing happens.
String fileLocation = serverList.get("Survival Mode");
Process p = Runtime.getRuntime().exec(fileLocation);
The file location in this instance is D:\Public\Minecraft Servers\Survival Mode\survivalmode.exe
All the exe/batch file does is as follows:
D:
cd "D:\Public\Minecraft Servers\Survival Mode"
java -Xmx1024M -Xms1024M -jar server.jar nogui
pause
EDIT:
Then for testing I used ProcessBuilder, I did something super simple and coded this:
private static void testRun() throws IOException {
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("cmd.exe", "/c", "dir C:\\");
Process process = processBuilder.start();
And again, nothing happens!!
Any ideas what I'm doing wrong? In eclipse even ran as administrator - nothing happens. It does not print a stack trace, no errors in the process, just.. nothing :(
TIA