Execute Shell Command from self-running .exe-file

297 Views Asked by At

I exported my Java-Application to a self-running jar-file, then compiled it to an .exe-file using Launch4j.

I figured, that Runtime.getRuntime().exec('shutdown -s -f -t <time in seconds>'); works only if I open the .jar-file from command-line. Running the compiled .exe from command-line doesn't work.

Why is that and is there any way to execute that command by simply opening the .exe-file?

0

There are 0 best solutions below