I have a project in NetBeans that starts with a main function, that takes arguments. When I hit the "Stop" Button, the project continues running, but there is no output anymore. Currently I have to remember to manually stop the process from the console.
How can I modify my project, maven setup or NetBeans configuration to make the process halt when I hit stop.
I can live with the process not having its finalizers or ShutdownHooks called.
Consider this class:
public class Main {
public static void main(String[] args) {
System.out.println("args: " + Arrays.asList(args));
new Main().action();
}
private void action() {
Date start = new Date();
long endTime = start.getTime() + 600000;
Date end;
do {
synchronized (Thread.currentThread()) {
try {
Thread.currentThread().wait(1000);
System.out.println("PING");
} catch (InterruptedException iex) {
return;
}
}
end = new Date();
} while (end.getTime() < endTime);
}
}
I want it to die using only NetBeans Stop button.