-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcesso.java
More file actions
executable file
·44 lines (35 loc) · 843 Bytes
/
Processo.java
File metadata and controls
executable file
·44 lines (35 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* @author JACKELINE
*
*/
public class Processo {
/**
* Esta classe so tem um metodo para criar outro processo.
*
* @return void
*/
public static void criarProcesso(String comando) {
Process novo = null;
BufferedReader buffer;
String entrada;
try {
novo = Runtime.getRuntime().exec(comando);
buffer = new BufferedReader(new InputStreamReader(novo
.getInputStream()));
novo.waitFor();
entrada = buffer.readLine();
while(entrada!=null){
System.out.println(entrada);
entrada = buffer.readLine();
}
buffer=null;
novo.destroy();
System.gc();
} catch (Exception expection) {
System.out.println("Nao foi possivel executar o aplicativo!");
System.exit(0);
}
}
}