I'm using the nativeswing libraries in a program i am working on, however, at a certain point in the program, i get a java.lang.IllegalStateException and it stalls. Basically, the program accesses a server, authenticates user/pass, if matches, then it opens a gui window...after the authentication, but before the window opens is when this exception happens.
I'm using Vista 64bit, a 32bit JVN with all 32 bit libraries, though i dont think the pc being 64 bit is an issue (the first time, a while ago, when i ran it with the same 64bit vista/32bit jvm and libs it did work fine)
heres the full exception:
Exception in thread "Thread-11" java.lang.IllegalStateException: The Native Swing framework is not initialized! Please refer to the instructions to set it up properly.
at chrriis.dj.nativeswing.NativeSwing.checkInitialized(NativeSwing.java:199)
at chrriis.dj.nativeswing.NativeSwing.addNativeComponentWrapper(NativeSwing.java:159)
at chrriis.dj.nativeswing.NativeComponentWrapper.checkParent(NativeComponentWrapper.java:42)
at chrriis.dj.nativeswing.NativeComponentWrapper.access$0(NativeComponentWrapper.java:34)
at chrriis.dj.nativeswing.NativeComponentWrapper$1.hierarchyChanged(NativeComponentWrapper.java:66)
at java.awt.Component.processHierarchyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.Component.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.addImpl(Unknown Source)
at javax.swing.JSplitPane.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at javax.swing.JSplitPane.setLeftComponent(Unknown Source)
at javax.swing.JSplitPane.setTopComponent(Unknown Source)
at org.avoir.realtime.gui.main.MainFrame.<init>(MainFrame.java:117)
at org.avoir.realtime.gui.main.LoginFrame$1.run(LoginFrame.java:123)
Anyone have an idea when/why this would happen, or why the state of the program/jvm could be inappropriate for this method?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm i though of that but didn't think it was a problem - its a program is being used by some other people who it works for, and i got the files fromt he same source as them using svn...looking through the code, the open() line is commented out in my code...and ofcourse uncommenting it fixes it...odd how svn didn't change that when updating.
...thanks though
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unless I am mistaken, this simply indicates that:
NativeInterface.open();
was not called in the main method. If you don't plan to open the interface when the program starts you need to at least initialize it with:
NativeInterface.initialize();
If the error is not this one, please let me know so that I investigate further.
Cheers,
-Christopher
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know that this post has been written a year ago, but the question is
basically the same.
In the main method I only do this: NativeInterface.initialize(). But when I
close my application, before the NativeInterface.open(); I get the same
exception that musnit have posted.
Anyone knows how can I resolve this?
Best regards,
Alejandro Caires
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Are you using a 0.9.9 preview version? If not, you should.
Indeed, I'm not using that version. I started to use it and one of the
problems has resolved :)
The question here was:
I've an application that has a login screen. When the application is
initialized the following method is executed: NativeInterface.initialize ().
Then the login is performed and is initialized a frame containing the main
menu of the application. Then, when the main menu of the application is
showed, the user can start JWebBrowser. Only when the user wants to open the
JWebBrowser the following method is executed: NativeInterface.open (). So what
I meant to say in the previous post, given what I just described, is that the
problem happened when the user was in the main menu and decides to close the
application before starting JWebBrowser.
I hope have achieved to explain what was the problem :)
Anyway, this issue was resolved by doing the following:
When the user decides to quit the application, before performing the
procedures necessary to terminate the application, the following code is
executed:
if (NativeInterface.isOpen()) {
NativeInterface.close();
}
With this code, I stopped having the exception that musnit mentioned and also
let me had the following exception:
NativeSwing: org.eclipse.swt.SWTException: Invalid thread access
NativeSwing: at org.eclipse.swt.SWT.error(Unknown Source)
NativeSwing: at org.eclipse.swt.SWT.error(Unknown Source)
NativeSwing: at org.eclipse.swt.SWT.error(Unknown Source)
NativeSwing: at org.eclipse.swt.widgets.Widget.error(Unknown Source)
NativeSwing: at org.eclipse.swt.widgets.Widget.checkWidget(Unknown Source)
.....
Hope I managed to resolve this problem correctly.
I'm also open to receiving any additional suggestions for solving this
problem.
Christopher, thank you very much for all the help and support.
Best regards,
Alejandro Caires
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With the version from August 6, you should not have any particular issue, and
you can call "NativeInterface.close()" without checking whether the interface
is open.
About the exception you are having, you still seem to call UI components from
outside the UI thread. Do you have the full stack trace?
Cheers,
-Christopher
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With the version from August 6, you should not have any particular issue,
and you can call "NativeInterface.close()" without checking whether the
interface is open.
Ok, thanks for the advice :)
About the exception you are having, you still seem to call UI components
from outside the UI thread. Do you have the full stack trace?
Sorry for my English :( What I meant to say is, besides the exception
mentioned by musnit, the exception that I mentioned in my previous post also
appeared. But calling "NativeInterface.close()", this same exception
disappeared.
Best regards,
Alejandro Caires
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using the nativeswing libraries in a program i am working on, however, at a certain point in the program, i get a java.lang.IllegalStateException and it stalls. Basically, the program accesses a server, authenticates user/pass, if matches, then it opens a gui window...after the authentication, but before the window opens is when this exception happens.
I'm using Vista 64bit, a 32bit JVN with all 32 bit libraries, though i dont think the pc being 64 bit is an issue (the first time, a while ago, when i ran it with the same 64bit vista/32bit jvm and libs it did work fine)
heres the full exception:
Exception in thread "Thread-11" java.lang.IllegalStateException: The Native Swing framework is not initialized! Please refer to the instructions to set it up properly.
at chrriis.dj.nativeswing.NativeSwing.checkInitialized(NativeSwing.java:199)
at chrriis.dj.nativeswing.NativeSwing.addNativeComponentWrapper(NativeSwing.java:159)
at chrriis.dj.nativeswing.NativeComponentWrapper.checkParent(NativeComponentWrapper.java:42)
at chrriis.dj.nativeswing.NativeComponentWrapper.access$0(NativeComponentWrapper.java:34)
at chrriis.dj.nativeswing.NativeComponentWrapper$1.hierarchyChanged(NativeComponentWrapper.java:66)
at java.awt.Component.processHierarchyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.Component.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.createHierarchyEvents(Unknown Source)
at java.awt.Container.addImpl(Unknown Source)
at javax.swing.JSplitPane.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at javax.swing.JSplitPane.setLeftComponent(Unknown Source)
at javax.swing.JSplitPane.setTopComponent(Unknown Source)
at org.avoir.realtime.gui.main.MainFrame.<init>(MainFrame.java:117)
at org.avoir.realtime.gui.main.LoginFrame$1.run(LoginFrame.java:123)
Anyone have an idea when/why this would happen, or why the state of the program/jvm could be inappropriate for this method?
Hmm i though of that but didn't think it was a problem - its a program is being used by some other people who it works for, and i got the files fromt he same source as them using svn...looking through the code, the open() line is commented out in my code...and ofcourse uncommenting it fixes it...odd how svn didn't change that when updating.
...thanks though
Hi Aidan,
Unless I am mistaken, this simply indicates that:
NativeInterface.open();
was not called in the main method. If you don't plan to open the interface when the program starts you need to at least initialize it with:
NativeInterface.initialize();
If the error is not this one, please let me know so that I investigate further.
Cheers,
-Christopher
I know that this post has been written a year ago, but the question is
basically the same.
In the main method I only do this: NativeInterface.initialize(). But when I
close my application, before the NativeInterface.open(); I get the same
exception that musnit have posted.
Anyone knows how can I resolve this?
Best regards,
Alejandro Caires
Hi Alejandro,
Are you using a 0.9.9 preview version? If not, you should.
As to your question, I don't understand why you "open()" when your application
gets closed. Any test case I could try to see the issue for myself?
Note that test cases can be sent to my e-mail address.
Hope this helps,
-Christopher
Hi Christopher,
Indeed, I'm not using that version. I started to use it and one of the
problems has resolved :)
The question here was:
I've an application that has a login screen. When the application is
initialized the following method is executed: NativeInterface.initialize ().
Then the login is performed and is initialized a frame containing the main
menu of the application. Then, when the main menu of the application is
showed, the user can start JWebBrowser. Only when the user wants to open the
JWebBrowser the following method is executed: NativeInterface.open (). So what
I meant to say in the previous post, given what I just described, is that the
problem happened when the user was in the main menu and decides to close the
application before starting JWebBrowser.
I hope have achieved to explain what was the problem :)
Anyway, this issue was resolved by doing the following:
When the user decides to quit the application, before performing the
procedures necessary to terminate the application, the following code is
executed:
if (NativeInterface.isOpen()) {
NativeInterface.close();
}
With this code, I stopped having the exception that musnit mentioned and also
let me had the following exception:
NativeSwing: org.eclipse.swt.SWTException: Invalid thread access
NativeSwing: at org.eclipse.swt.SWT.error(Unknown Source)
NativeSwing: at org.eclipse.swt.SWT.error(Unknown Source)
NativeSwing: at org.eclipse.swt.SWT.error(Unknown Source)
NativeSwing: at org.eclipse.swt.widgets.Widget.error(Unknown Source)
NativeSwing: at org.eclipse.swt.widgets.Widget.checkWidget(Unknown Source)
.....
Hope I managed to resolve this problem correctly.
I'm also open to receiving any additional suggestions for solving this
problem.
Christopher, thank you very much for all the help and support.
Best regards,
Alejandro Caires
Hi Alejandro,
With the version from August 6, you should not have any particular issue, and
you can call "NativeInterface.close()" without checking whether the interface
is open.
About the exception you are having, you still seem to call UI components from
outside the UI thread. Do you have the full stack trace?
Cheers,
-Christopher
Hi Christopher,
Ok, thanks for the advice :)
Sorry for my English :( What I meant to say is, besides the exception
mentioned by musnit, the exception that I mentioned in my previous post also
appeared. But calling "NativeInterface.close()", this same exception
disappeared.
Best regards,
Alejandro Caires