My test code is like following :
public static void main(String[] args) throws IOException, InterruptedException {
        // TODO Auto-generated method stub
        while(true) {
            Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() 
            { 
              public void run() 
              { 
                System.out.println("Shutdown Hook is running !"); 
                System.out.println("Application Terminating ...");
              } 
            })); 
            System.out.println("Running");
        } 
    }
I run the code in eclipse, go to debug tab where I can see it in running state.I do right click -> terminate .And shutdown hook won't execute.
Output printed :
Running
Running
Running
.
.
.
.
.
.
 
     
     
    