Why does the program not terminate when a method that throws RuntimeException is called without hand

Class 1:

package hf; public class apples { public static void main(String[] args) { Good good = new Good(); good.method(); } }

Class 2:

package hf; public class Goodie extends NullPointerException { }

Class 3:

package hf; public class Good { public void method() throws Goodie { System.out.println("Goodmethod"); throw new Goodie(); } }

I have not used any try/catch block to catch the NullPointerException(which extends RunTimeException) that is thrown when I call good.method() in class 1. When I run the program, the console in Eclipse indicates that the program is still running because it does not show at the top of the console box, like it usually does when the program execution is over.

Why is the program still running?

How can I bring the program execution to halt without pressing the red stop button?


The program you have posted will terminate when you throw the uncaught exception. I just tested it myself.

The only way to prevent the JVM from terminating is to have non-daemon threads running. If you have displayed a GUI for instance, you must make sure you terminate the EDT to for the application to terminate completely.


When we run an app in debug mode in Eclipse it will stop on uncaught exceptions if Windows->Preferences->Java->Debug->Suspend execution on uncaught exceptions is set.


  • LibGDX GwtApplication Exception (TypeError) in HTML Deployment
  • Delete specific queue when client's idle time in activemq
  • How to start a Mysql server in Java programatically?
  • Exclusive access established by another Thread Java smartcardio
  • Visual Studio not stopping on an exception being thrown
  • How do I add a File Type Association in a Windows Phone 8.1 app manifest?
  • Ionic storage “get” returns null only on the second call within method
  • Responsive left sidebar open close
  • multidatatrigger with multibinding in ControlTemplate.Triggers
  • Interpreting STRACE output - pipes and forks
  • Prevent page break in text block with iText, XMLWorker
  • Issue with routerLink directive
  • How can I get the full list of running processes on a Mac from a python app
  • MySQL performance when updating row with FK
  • C++ friend class std::vector
  • Cloud Code function running twice
  • SyntaxError: (irb):26: both block arg and actual block given
  • Simple linked list-C
  • Sending keystrokes/mouse clicks to a Java program with Autohotkey
  • URLConnection doesn't work since API 10 and higher?
  • Center align outputs in ipython notebook
  • Reading a file into a multidimensional array
  • App restarts from wrong activity
  • Thread safety of a fluent like class using clone() and non final fields
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • Converting a WriteableBitmap image ToArray in UWP
  • Jetty Server not starting: Unable to establish loopback connection
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Why value captured by reference in lambda is broken? [duplicate]
  • javascript inside java/jsp code
  • sending/ receiving email in Java
  • ActionScript 2 vs ActionScript 3 performance
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • How can I estimate amount of memory left with calling System.gc()?
  • Apache 2.4 - remove | delete | uninstall
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • How does Linux kernel interrupt the application?
  • Busy indicator not showing up in wpf window [duplicate]
  • Why do underscore prefixed variables exist?