java.io.IOException: Cannot run program \": Create

2019-09-06 14:36发布

问题:

I fixed my file path but now getting this 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();

回答1:

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.



标签: java shell