Как мне выполнить внешнее приложение, передать аргументы и вернуть результат из внешнего приложения, используя java #ProcessBuilder и #RunTime?
public class test {
public static void main(String[] args) {
try {
System.out.println("Starting Application");
// Runtime runtime =Runtime.getRuntime();
Process proc= new ProcessBuilder("NconnectLicenseGenerator.exe","ABCDEFGHIJK").start();
InputStream is = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
System.out.printf("Output of the program is %s :" ,Arrays.toString(args));
Здесь я хочу передать аргументы моему приложению и отправитьаргументы через Java и возвращают результаты
while((line=br.readLine())!=null)
{
System.out.println(line);
}
System.out.println("Closing Application");
} catch (IOException e) {
e.printStackTrace();
}
}
}