Error calling Java from Ergo

1 view
Skip to first unread message

Rangarajan Krishnamoorthy

unread,
Nov 14, 2018, 10:21:31 PM11/14/18
to ErgoAI, Flora-2, and XSB Users Forum
Hi,
I am checking the Ergo to Java interface (I have an evaluation version of Ergo on my Windows machine).

After launching the Ergo IDE, I typed the following command in the Listener:

ensure_loaded @\e2j.

System response:
Times (in seconds): elapsed = 0.000; pure CPU = 0.000

Yes

... done ...

I then entered the following (example given on P23 of "A Guide to ErgoAI Packages" manual):

'123abc789'[message(split(abc)) -> ?P]@\e2j.

System response:
++Error[Ergo]> attempt to call a Prolog predicate in a nonloaded module `ergo_java'

... done ..
.

What could be the problem?

- Rangarajan

Rangarajan Krishnamoorthy

unread,
Nov 14, 2018, 10:27:33 PM11/14/18
to ErgoAI, Flora-2, and XSB Users Forum
I am sorry the last System response is not clear in my post. It is:


++Error[Ergo]> attempt to call a Prolog predicate in a non-leaded module ‘ergo_java’


… done …


- Rangarajan

Michael Kifer

unread,
Nov 14, 2018, 11:11:27 PM11/14/18
to ErgoAI, Flora-2, and XSB Users Forum

This feature (sending messages to Java) currently works only in the terminal window and not in the IDE.
Very soon we'll release an update that takes care of this problem.

Rangarajan Krishnamoorthy

unread,
Nov 15, 2018, 3:18:38 AM11/15/18
to ErgoAI, Flora-2, and XSB Users Forum
OK, no problem.

I started the terminal mode (executed the batch file "runergo.bat") and then entered the following:

ensure_loaded @\e2j.

This worked.

System[addJar('lispcalls.jar')]@\e2j.

This triggered a warning. I am attaching the screenshot that shows the messages.

What could be wrong this time?

- Rangarajan
Ergo-java warning.PNG

Michael Kifer

unread,
Nov 15, 2018, 12:50:06 PM11/15/18
to ErgoAI, Flora-2, and XSB Users Forum
You are probably using Java 9 or 10. In Java 9 they made an incompatible change, which breaks dynamic Jar loading. So, addJar doesn't work in Java 9+ until we find a good solution.
If you need to use a Jar, add it when your Java program starts up (or use Java 8).

--michael
Reply all
Reply to author
Forward
0 new messages