Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3807208
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:57:18+00:00 2026-05-19T14:57:18+00:00

Below is piece of program I was using to simply Open and close the

  • 0

Below is piece of program I was using to simply Open and close the Internet Explorer from my command line program. im running my program with Java 6 on Windows XP OS:

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())

The exit value is : 1.

Javadoc says: by convention, the value 0 indicates normal termination.
http://download.oracle.com/javase/6/docs/api/java/lang/Process.html#exitValue()

Then I commented 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 returning ‘0’.

My question is:

  1. Why program returns exit code as ‘1’ in first case? Does JVM treats p1.destroy() as abnormal way of terminating a program?
  2. In general the ‘exit status code’ value is JVM specific or Operating system specific? I have seen some question where people have reported exit code value as ’10’, ‘34545’ etc..

Thank you for reading,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:57:19+00:00Added an answer on May 19, 2026 at 2:57 pm

    Actually, that’s two questions 🙂

    1. Almost certainly, IE itself captured the fact that it was being shut down externally and decided to return that error code (see 2 below). So no, the JVM doesn’t treat p1.destroy() as a special case, but the affected process may.

    2. Exit values are process specific, not JVM specific (and not even OS specific). In other words, a process itself returns a value to be used as the exit value. This makes sense when you think of the fact that there are ways to destroy processes which don’t involve the JVM at all.


    I should mention that there are cases where the process doesn’t affect the exit code. Under some UNIX-like operating systems, if a process exits due to some serious fault (like a segmentation violation or a violent external shutdown), the exit code may be set by the OS to a value indicating this. From memory, it was something like 128 plus the signal number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I m working on java. i m trying below piece of code public Proxy
Below are lines from the c++ programming language template<class T > T sqrt(T );
(In short: main()'s WaitForSingleObject hangs in the program below). I'm trying to write a
I'm having some trouble stepping over in GDB. I've built an example program from
Below i have pasted my piece of javascript code here 1) function showCustomerName(dropdown) {
I've got a piece of JavaScript that inserts/removes an iframe from the DOM. Everything
I am running VB with the follwing piece of code conider strSQL to be
I am attempting to pull some information from my tnsnames file using regex. I
I have the below piece of code which Prefixs a string to the start
In the below piece of code, is there a way to not need a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.