Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.io.IOException: Cannot run program ": CreateProcess error=193, %1 is not a valid Win32 application

Tags:

java

shell

I'm getting the below error when trying to run a shell script from java in Eclipse.

I just created a text file on my local and wanted to see if it will run.

new ProcessBuilder("C:/Users/myDir/Desktop/ss1.sh").start();
like image 982
Doc Holiday Avatar asked Sep 20 '25 03:09

Doc Holiday


1 Answers

You cannot run a shell script on Windows directly as it is no executable in the Windows sense (only .exe, .com, .cmd and .bat are executables).

Call bash.exe or sh.exe and use your script as the first parameter.

like image 57
MrTux Avatar answered Sep 22 '25 16:09

MrTux