• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Invoking DLL from a Swing GUI

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have succesfully completed an Java gateway to a DLL so that the functions within the DLL can be invoked. Everything works fine when running the application from the command line. However, now I have developed a Swing GUI to enhance the usability, but when invoking the DLL from the GUI as a result of a butten click event, I get an exception starting with "Exception in thread "AWT-EventQueue-0" (...)". I guess it has something to do with a multithreading issue? Does anyone know how to solve this?

Thanks in advance and kind regards,

Jeroen Oosterlaar
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wouldn't think that it's a threading issue, but rather that a case of the library not being found. Is the DLL in your PATH? Also, post the full stack trace.
 
Jeroen Oosterlaar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently, I can't get to the application, so I can't post the exception stack trace, yet, but I'm absolutely sure it is not caused by the library not being found. In fact, the exception output contains a messsage that is given by the DLL itself, saying that it fails at some stage during initialization. So, the loading of the DLL is succesfully established, but it fails to initialize (more specifically: it fails loading the book keeping administration that will be manipulated by our Java application). And this error only comes up, when the class that takes care of the DLL communication is instantiated and instructed to set up the connection from the GUI (after clicking a button). It does, however, run completely succesful, when the DLL communicating class is instantiated and instructed to set up the connection directly in the public static void main(String[] args) method:


[ February 28, 2007: Message edited by: Jeroen Oosterlaar ]
 
Jeroen Oosterlaar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I have the output of the exception that is thrown, when the DLL is invoked from my Swing GUI:


Exception in thread "AWT-EventQueue-0" com.ibm.bridge2java.ComException: Er is een fout opgetreden tijdens het openen van de administratie.

Fase 9: controle demo. Object variable or With block variable not set
at com.ibm.bridge2java.Dispatch.IDispatch_Invoke(Native Method)
at com.ibm.bridge2java.Dispatch.invoke_method_void(Dispatch.java:132)
at nl.viab.snelstart.dll._clsGWaySnelStart.mtdGWayAdmiOpenen(_clsGWaySnelStart.java:73)
at nl.viab.snelstart.Executor.<init>(Executor.java:21)
at nl.viab.snelstart.GUI.jButton1ActionPerformed(GUI.java:170)
at nl.viab.snelstart.GUI.access$000(GUI.java:15)
at nl.viab.snelstart.GUI$1.actionPerformed(GUI.java:106)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)



Some relevant code regarding invoking the DLL from the GUI:



However, when new Executor() is called from the command line...



...everything runs completely succesful.
reply
    Bookmark Topic Watch Topic
  • New Topic