Need help for run a Java interface inside the prolog code......

104 views
Skip to first unread message

Chamara Madushanka

unread,
Oct 15, 2015, 10:05:32 AM10/15/15
to SWI-Prolog


Hi I want need to develop a Java interface inside the prolog program. When the prolog start, then java interface must be open.

I will look for prolog jpl examples. And Java to prolog calling part is working. But prolog to java calling part not working. Can you help me to solve this problem.

My OS  ==> windows 10; (64-bit)
Java Version ==> jdk1.8.0_60; (64-bit)
Prolog Version ==> 7.3.8 (64-bit);

And also I put System Variables... (I set Java path and Prolog path)

For Java ==> C:\Program Files\Java\jdk1.8.0_60\bin;

For Prolog ==> C:\Program Files\swipl\bin;

When I run a simple example (eg jpl_jlist_demo ) Prolog showing above error message. Please Help me to solving this error.

Thank You
pr.JPG

Jan Wielemaker

unread,
Oct 15, 2015, 10:34:33 AM10/15/15
to Chamara Madushanka, SWI-Prolog
On 10/15/2015 04:05 PM, Chamara Madushanka wrote:

This is a known issue. The solution is not really known :( Typically
it helps to make sure %PATH% is not too long. Google for
`swipl file name contains 0-code` to see more of this.

I do see something interesting. The path component ends with
....60\\B\000\I\000\ Note that \000\ is Prolog's weird (but ISO
standard) way to indicate the character code 0. So, it seems the
first part of the variable is translated properly, but the second
part looks like a Unicode (wchar_t) array interpreted as a char
(Windows `Ansi') array.

Can you describe where you defined %PATH% and how exactly it is
defined? Is %PATH% defines in terms of other variables? Which?
What are their values? What is your language setting?

Thanks --- Jan

> <https://lh3.googleusercontent.com/-N5oAWJM-01k/Vh-wNDPJc0I/AAAAAAAAFo4/QZrUKBb8WRk/s1600/pr.JPG>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/swi-prolog.
> For more options, visit https://groups.google.com/d/optout.

Chamara Madushanka

unread,
Oct 15, 2015, 11:04:39 AM10/15/15
to SWI-Prolog, 92ch...@gmail.com
I set the windows path like following. And it only contain java jdk path. But In error showing Java jvm path.

What shall I do now?




Jan Wielemaker

unread,
Oct 15, 2015, 1:57:58 PM10/15/15
to Chamara Madushanka, SWI-Prolog
On 10/15/2015 05:04 PM, Chamara Madushanka wrote:
> I set the windows path like following. And it only contain java jdk
> path. But In error showing Java jvm path.

Well, I already see apache-maven there as well. Can you get the whole
value, preferably as text instead of an image, so I can copy/paste it?
I think the international/language settings might be important too.

Cheers --- Jan

> What shall I do now?

Install a real OS? :)

Jan Wielemaker

unread,
Oct 15, 2015, 4:11:22 PM10/15/15
to Chamara Madushanka, SWI-Prolog
On 10/15/2015 05:04 PM, Chamara Madushanka wrote:
> <https://lh3.googleusercontent.com/-_Ng_H7G6ZJc/Vh_AcknYjRI/AAAAAAAAFpM/_cPu8WftvlM/s1600/jpl.JPG>

Looking through the old stuff, I found this (by Anne):
http://mailman.few.vu.nl/pipermail/cliopatria-list/2013-February/000162.html

I tried it though, and it doesn't go wrong for me. Now my path is really
short (just 134 characters) because my Windows virtual machine is really
empty and only used to test SWI-Prolog for things that cannot be
reproduced in Linux. The only stuff installed besides Prolog are git and
Java ..

Cheers --- Jan

Chamara Madushanka

unread,
Oct 17, 2015, 12:18:54 PM10/17/15
to SWI-Prolog, 92ch...@gmail.com
First of all thank you for your help....

Finally I fixed error.

I think there is an error in JPL. Because when the system variable path's no of characters are < 1024 then JPL works correctly. Else it give me above error.

Anywey  thank you for help me.

Jan Wielemaker

unread,
Oct 18, 2015, 4:30:33 AM10/18/15
to Chamara Madushanka, SWI-Prolog
On 10/17/2015 06:18 PM, Chamara Madushanka wrote:
> First of all thank you for your help....
>
> Finally I fixed error.

Great.

> I think there is an error in JPL. Because when the system variable
> path's no of characters are < 1024 then JPL works correctly. Else it
> give me above error.

Well, the error is related to %PATH%, we know as much as that. It might
be a real bug in Windows and it might be some detail in how SWI-Prolog
tries to get %PATH%. Just about nothing seems to reproduce though. The
solution to fix it often involves making %PATH% shorter, but sometimes
other changes work fine too ... At least [1] suggests the real problem
is in Windows. You can still help if you can provide details on

- The broken and correctly working setting of the Path variable
- Both the user and system setting
- How you set/edited the variable (delete/recreate var, copy/paste,
copy from which application, etc).

I also suspect installers used for other programs.

Also interesting for a PATH that breaks JPL/Prolog: what is the result of
`echo %PATH%` in cmd.exe and ?- getenv('PATH', Path). in Prolog?

This issue is popping up so often that it would be really nice to get rid of
it.

Cheers --- Jan

[1]
http://mailman.few.vu.nl/pipermail/cliopatria-list/2013-February/000162.html

>
> Anywey thank you for help me.
>
Reply all
Reply to author
Forward
0 new messages