M
Murrgon
I am running a basic swing application and I don't want the JVM to
shutdown automatically when the last window is closed. From the
documentation at JDK/docs/api/java/awt/doc-files/AWTThreadIssues.html
there is the following:
"On the other hand, if you require the JVM to continue running even
after the application has made all components undisplayable you
should start a non-daemon thread that blocks forever."
<...>
Runnable r = new Runnable() {
public void run() {
Object o = new Object();
try {
o.wait();
} catch (InterruptedException ie) {
}
}
};
Thread t = new Thread(r);
t.setDaemon(false);
t.start();
<...>
So I added this to my code and now I get this error message:
java.lang.IllegalMonitorStateException: current thread not owner
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Unknown Source)
at Process$1.run(Process.java:24)
at java.lang.Thread.run(Unknown Source)
Is this to be expected? What exactly is this exception telling
me? Should I catch this exception and dispose of it?
Thanks
Murrgon
shutdown automatically when the last window is closed. From the
documentation at JDK/docs/api/java/awt/doc-files/AWTThreadIssues.html
there is the following:
"On the other hand, if you require the JVM to continue running even
after the application has made all components undisplayable you
should start a non-daemon thread that blocks forever."
<...>
Runnable r = new Runnable() {
public void run() {
Object o = new Object();
try {
o.wait();
} catch (InterruptedException ie) {
}
}
};
Thread t = new Thread(r);
t.setDaemon(false);
t.start();
<...>
So I added this to my code and now I get this error message:
java.lang.IllegalMonitorStateException: current thread not owner
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Unknown Source)
at Process$1.run(Process.java:24)
at java.lang.Thread.run(Unknown Source)
Is this to be expected? What exactly is this exception telling
me? Should I catch this exception and dispose of it?
Thanks
Murrgon