I am executing a shell script from Java program. I have implemented it using Runtime class. Below is the code I implemented
final StringBuilder sb = new Stri
To recreate the command you run in shell manually, test.sh "/path to/my/text file"
, you will need to include the quotes.
final StringBuilder sb = new StringBuilder("test.sh");
sb.append(" \"/path to/my/text file\""); //notice escaped quotes
final Process p = Runtime.getRuntime().exec(sb.toString());