The following is a snippet of the program that I used to simply open and close Internet Explorer from my command line. im runs my program using Java 6 on Windows XP:
Runtime runtime = Runtime.getRuntime();
Process p1 = runtime.exec("C:\\Program Files\\Internet Explorer\\iexplore.exe");
Thread.sleep(5000);
p1.destroy();
Thread.sleep(2000);
System.out.println("p1.exitValue(): "+p1.exitValue())
Output Value: 1.
Javadoc says: by convention, a value of 0 indicates normal completion.
http://download.oracle.com/javase/6/docs/api/java/lang/Process.html#exitValue ()
Then I commented on p1.destroy and instead of closing the browser from my Java program, I closed the window manually (File> Exit). In this case, p1.exitValue started to return '0'.
My question is:
- Why does the program return the exit code as "1" in the first case? Does the JVM approach p1.destroy () as an abnormal way to terminate a program?
- " " JVM ? , "10", "34545" ..
,