(Solved) Javaw process wont close after the exit of my program (Eclipse)

So I am using Processing via Eclipse and the processes just wont close after the exit of my program. I noticed it after my computer startet to get really slow and I opened the task manager and yay 10 javaw processes! When I use the Processing editor however, it does close the processes normally.

regards, TPRammus

Tagged:

Answers

  • But that doesn't seem to really be an Processing issue I guess... But okay I will report it there.

    regards, TPRammus

  • Not sure if this will help but use the red stop button in Eclipse to stop the Processing sketch rather than the one on the sketch. Worth trying.

  • @quark But what about the exported version of the program? It wouldn't really bother me if it would only affect my project when running it in Eclipse.

  • edited April 2017 Answer ✓

    Solved! I actually submitted a new issue but I figured it out now. You need to call System.exit(0); for the Java process to actually terminate. And since there is the method public void exit() which will be called when the user closes the program, you can work out something like this:

        public void exit() {
                super.exit();
                System.exit(0);
        }
    

    (it will automatically called at the exit of your program) Thanks for all the help!

    regards, TPRammus

  • edited April 2017 Answer ✓

    It is not clear in the documentation but if you create a public void exit() method then you must call the overridden method as shown in your example.

    Typically you would have

    public void exit() {
      // Stop the sketch looping
      noLoop(); 
      // Perform any code you like but some libraries like minim 
      //need to be stopped manually. If so do that here.
      // Now call the overridden method. Since the sketch is no longer looping
      // it will call System.exit(0); for you
      super.exit(); 
    }
    
Sign In or Register to comment.