Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import java.lang.Thread;
  2.  
  3. public class AsynCommand {
  4. public static void main(String... args) {
  5. Thread echo = new Thread(new Command('/usr/bin/bash', 'echo', 'Hello World'));
  6. echo.start();
  7. }
  8.  
  9. public class Command extends Runnable() {
  10. String[] args;
  11. Process process;
  12.  
  13. public Command(String... args) {
  14. this.args = args;
  15. }
  16.  
  17. @Override
  18. public void run() {
  19. process = Runtime.getRuntime().exec(args);
  20. }
  21.  
  22. public Process getProcess() {
  23. return process;
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement