IOException:cannot run program:CreateProcess error=193,%1 is not a valid Win32 application

IrApp picture IrApp · Nov 12, 2014 · Viewed 8.2k times · Source

I am trying to run a shell script that runs in MinGW32. Then I get the following error:

Caused by:

java.io.IOException: Cannot run program "./myJooqGeneratorDB.sh", (in directory "C:\Users\admin\desktop\workspace\myProject") CreateProcess error = 193, %1 is not a valid win32 application.

My build.gradle:

task createDb(type:Exec) {
workingDir("${project.projectDir}");
commandLine './jooq/myJooqGeneratorDb.sh'
}  

My myJooqGeneratorDb.sh:

#!/bin/bash
rm build/project.db
mkdir build
sqlite3 build/project.db < res/raw/project_create.sql

Does someone know what it's wrong in my code?. Thanks in advance!

Answer

IrApp picture IrApp · Nov 12, 2014

I just fixed the problem. Instead of :

commandLine './jooq/myJooqGeneratorDb.sh'

is

commandLine 'sh' , './jooq/myJooqGeneratorDb.sh'