Example

protected void finalize() throws Throwable {
System.out.println("Calling RunFinalizersInExit finalize"); //$NON-NLS-1$
super .finalize();
}

public static void main(String[] args){
RunFinalizersOnExit_Example rfoe = new RunFinalizersOnExit_Example();
Runtime.runFinalizersOnExit(true);
}

Solution
Remove this call and let garbage collector do the job.