java - Execute bash script in eclipse -
i'm trying figure out how execute simple bash script java program inside eclipse. have checked questions cannot run program "..../abc.exe": error=13, permission denied , permission denied when running shell script java program, still have error:
ioexception: cannot run program "prog" error=13, permission denied.
i have checked file permissions:
-rwxrwxr-x user user prog
i use snippet execute script:
file file = new file(this.getclass().getclassloader().getresource("prog").getfile()); processbuilder processbuilder = new processbuilder(file.getabsolutepath()); try { process process = processbuilder.start(); process.waitfor(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); }
when invoking bash scripts java must specify '/bin/bash' executable , pass script path argument.
Comments
Post a Comment