Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.lang.Thread;
- public class AsynCommand {
- public static void main(String... args) {
- Thread echo = new Thread(new Command('/usr/bin/bash', 'echo', 'Hello World'));
- echo.start();
- }
- public class Command extends Runnable() {
- String[] args;
- Process process;
- public Command(String... args) {
- this.args = args;
- }
- @Override
- public void run() {
- process = Runtime.getRuntime().exec(args);
- }
- public Process getProcess() {
- return process;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement