Alex Alex -5 years ago 229
Java Question

Java - Create Process Error = 193

I am trying to run an external program, which is an executable jar-File (if i double-click), but I am getting the error that the file is not a windows32 application.

try {
String filepath = "C://Users//Name//Desktop//Speedtest.jar";
Process p = Runtime.getRuntime().exec(filepath);
} catch (IOException e) {

Answer Source

Jar file in itself is not a win-32 application. (It is actually like a zip file.)

java is a win-32 application, which runs the jar file.

So, you need to run the jar file using the command:

java -jar <jar-file>

You can do this:

String filepath = "java -jar C:/Users/Name/Desktop/Speedtest.jar";
Process p = Runtime.getRuntime().exec(filepath);

This should work fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download