下面是源代码
Scanner myObj = new Scanner(System.in);
String name = args[0];
if (name.contains("hello")) {
System.out.print("Enter another name : ");
name = myObj.nextLine();
} else {
System.out.println(name);
}
System.out.println("Entered name : " + name);
调用jar文件的processbuilder代码。但不知道如何传递值?
ProcessBuilder pb = new ProcessBuilder("java", "-jar", "C:\\Temp\\TestJar.jar", "hello");
pb.redirectErrorStream(true); // redirect error stream to output stream
pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
Process proc = pb.start();
System.out.println("Job running");
proc.waitFor();
System.out.println("Job finished");
暂无答案!
目前还没有任何答案,快来回答吧!