开发者

Many instances of javaw.exe

Task Manager shows many instances of javaw.exe residing in m开发者_如何学编程emory making windows run out of memory. I'm using this code to close my java application:

SwingUtilities.invokeLater(new Runnable() 
{
    public void run()
    {
       Form1 frame = new Form1();
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
});

How can I fix this problem?


Use ProcessExplorer instead of TaskManager.
Select one of the javaw.exe processes, go to the image tab, and you will be able to see the full command line.
This will help you to determine what the javaw.exe processes actually are.


Firstly ensure %JAVA_HOME%/bin is set in your PATH and %JAVA_HOME% is pointed to your JDK.

Then to leverage these JDK tools,

use jps -l to list all the java processes.

use jstack -l <pid> to check the stack trace and you can find some clues.


Try this:

frame.addWindowListener(new WindowAdapter(){
     public void windowClosing(WindowEvent we){
        System.exit(0);
     }

Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜