Skip to content

Instantly share code, notes, and snippets.

@ruan65
Created January 19, 2018 11:27
Show Gist options
  • Save ruan65/e38cd5b72fc45e66aaa59ad4b1b301da to your computer and use it in GitHub Desktop.
Save ruan65/e38cd5b72fc45e66aaa59ad4b1b301da to your computer and use it in GitHub Desktop.
run bash via java
public static void main(String[] args) {
String[] cmd = new String[]{"/bin/sh", "/home/a/temp/notify.sh"};
try {
Process pr = Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment