java - Unable to call external Bash program when exporting project as runnable jar -


i have java project requires external bash script work. works fine in eclipse, once export runnable jar, following error: cannot run program "src/script.sh": error=2, no such file or directory

i have tried:

runtime.getruntime().exec("script.sh"); 

as as

new processbuilder("src/script.sh").start(); 

the bash script takes in no input , not return output

your script buried inside jar file , doesn't exist standalone file, that's why java can't "execute" it. need read @ runtime using resources api, save (temporary?) directory, set executable permission, , run using processbuilder or such.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -