I have a .sh file stored in some Linux system. The full path of the file is:
/comviva/CPP/Kokila/TransactionHandler/scripts/stopTH.sh
>
I did a quick test here, the following works assuming you have /bin/bash on your machine:
my /tmp/test.sh:
#!/bin/bash
echo `ls`
my java code:
try {
InputStream is = Runtime.getRuntime().exec("/bin/bash /tmp/test.sh").getInputStream();
int i = is.read();
while(i > 0) {
System.out.print((char)i);
i = is.read();
}
} catch (IOException e) {
e.printStackTrace();
}
output: all files in current directory
edit: i kinda overlooked that "execute from windows" comment. I don't know what you mean with that.