Executando .jar no Java


package br.com.agente;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Teste2 {

public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Process processo = Runtime.getRuntime().exec("java -jar bdi-java-0.0.1-SNAPSHOT-jar-with-dependencies.jar 'cam1Exemplo'");
if(processo.isAlive()) {
System.out.println("Processo esta ativo...");
}

System.out.println("Result:");
BufferedReader reader = new BufferedReader(new InputStreamReader(processo.getInputStream()));

String line = "";
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
}
}

}

Comentários

Postagens mais visitadas deste blog

Instalação NetBeans