Subject: Yet another question about JPL

From: Pascal Vaillant <[email-masked]>
Date: Tue, 25 Jan 2000 01:43:22 +0000 (GMT)

Hello,

We are trying to use Fred Dushin's JPL package to pilot SWI-Prolog
from within a java program.

First, we implemented some test communication functions, by adapting
Fred's Test.java file skeleton. In text mode, on an xterm, everything
worked fine.

Now we are trying to integrate the same functions in our GUI. The
first expected task is to establish a connection to SWI-Prolog, when
a button is pressed. But it fails immediately at that point.

We fear the problem might be linked to implicit java threads. However
we get some error message about the JPL/Atom class not being found,
and are worrying about why the same classes with the same environment
fail to be loaded in this context.

Here are some pieces of code, in case somebody could easily spot the
problem. Apologies in advance if this is a trivial problem!

 Context description:
 Pressed button: jButtonC1
 ....
     jButtonC1.addActionListener(new java.awt.event.ActionListener() {
       public void actionPerformed(ActionEvent e) {
         generateGraph_actionPerformed(e);
       }
     });
 ...
    void generateGraph_actionPerformed(ActionEvent e) {
    System.out.println("Testing the jpl interface");
    java.lang.String myargs[]={ "pl", "-x", "allglottai", "-g", "true" };
    glottaiInterface.jpl_init(myargs);
 ...
    System.out.println("JPL connected ...");
   }

 ... and in glottaiInterface:

     public static void
	 jpl_init(java.lang.String exeString[])
     {
 ...
	 JPL.init(exeString);
 ...
     }

We get these error messages:

 Testing the jpl interface
 java.lang.NoClassDefFoundError: jpl/Atom
         at 
         at glottai.gui.glottaiFrame.generateGraph_actionPerformed(glottaiFrame.java:404)
         at glottai.gui.glottaiFrame$4.actionPerformed(glottaiFrame.java:172)
         at com.sun.java.swing.AbstractButton.fireActionPerformed(AbstractButton.java:860)
         at com.sun.java.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:895)
         at com.sun.java.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:338)
         at com.sun.java.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:230)
         at com.sun.java.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:156)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:235)
         at java.awt.Component.processMouseEvent(Component.java:2284)
         at java.awt.Component.processEvent(Component.java:2129)
         at java.awt.Container.processEvent(Container.java:894)
         at java.awt.Component.dispatchEventImpl(Component.java:1764)
         at java.awt.Container.dispatchEventImpl(Container.java:939)
         at java.awt.Component.dispatchEvent(Component.java:1704)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:1548)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1457)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1392)
         at java.awt.Container.dispatchEventImpl(Container.java:926)
         at java.awt.Component.dispatchEvent(Component.java:1704)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)

(If somebody may give an example of function which successfully
calls JPL functions on the pressing of buttons?)

Many thanks in advance,

Michèle and Pascal Vaillant

--
Pascal Vaillant                                Jägerstraße 10/11
Humboldt Universität zu Berlin                 10117 Berlin (Allemagne)
Lehstuhl Computerlinguistik                    Tel: (+49/30) 20 19 25 54