Re: JPL error

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Weird things are going on.  My jpl.pl has no WINEPATH mentioned.  Where
did you find that?  You can debug this by commenting in jpl.pl these two
lines:

% near start
:- set_prolog_flag(generate_debug_info, false).

% near end.
:- initialization(setup_jvm, now).

The do

?- [library(jpl)].
?- gtrace, setup_jvm.

and see what happens.  What exactly happens depends a lot on the 
platform.  Debugging this is a bit nasty because the OS tells you
that some dependency is missing, but not which one :-(  You can use
a DLL dependency walker to see what all the dependencies are.

	Cheers --- Jan


On 08/01/2013 02:18 PM, Jerry wrote:
>  From inspecting jpl.pl more closely It looks like the foreign library load
> of jpl fails for some reason. The later messages are an attempt by
> jpl.plto diagnose what the problem was. I probably need to take a
> closer look at
> the jpl foreign source but I wonder what actual mechanisms are used when
> the foreign code executes. Jpl.pl is looking at WINEPATH. It also seems to
> try multiple methods to locate things using JAVA_HOME, windows registry
> keys, etc. What is actually used in the foreign code? Perhaps my working
> saved program has already performed steps in initializing jpl whereas the
> non-working interpreted version is failing on an earlier step that the
> saved version does not need to perform. How is initialization different
> between a saved and non-saved program regarding JPL? The saved program
> imported the JPL module prior to being saved.
>
> Thanks!
> Jerry
>
>
> On Thu, Aug 1, 2013 at 6:30 AM, Jerry <[email protected]> wrote:
>
>> Paul,
>>
>> This is what I get:
>>
>> 1 ?- jpl_new('java.util.Date', [], X).
>>
>> ERROR: c:/program files/swipl/library/jpl.pl:4637:
>>          '$open_shared_object'/3: The specified module could not be found.
>> ERROR: Exported procedure jpl:jpl_c_lib_version/1 is not defined
>> ERROR: jpl:jFindClass/2: Undefined procedure: jpl:jni_func/3
>>     Exception: (10) jpl:jni_func(6, 'java/util/Date', @_G963) ?
>>
>>
>> The thing is I have two versions of the same prolog application on one
>> machine. One version is interpreted and the other saved with qsave from an
>> earlier version of prolog. The first does not run yet the 2nd runs fine. I
>> can rename either jvm.dll or java.dll and the expected error shows up. The
>> other one makes no difference (always error). It is interesting to note
>> that when I remove all path variables to jvm/java I get the jvm.dll popup
>> and a message saying need to add java.dll to WINEPATH. When I add that to
>> WINEPATH that error goes away and I get an error message saying the same
>> thing about jvm.dll. When I add that to WINEPATH that error message goes
>> away and the next error is Exported procedure jpl:jpl_c_lib_version/1 is
>> not defined. That would imply  it found jvm.dll and the jvm.dll popup error
>> happens in every case. I am wondering if the popup error message happens if
>> any one of several problems occur. Here is the progression of errors as I
>> fix specific errors:
>>
>> No java.dll or jvm.dll in WINEPATH
>>
>> % Added [C:\Program Files\Java\jre6\bin] to %PATH%
>>
>> ERROR: c:/program files/swipl/library/jpl.pl:4637:
>>          '$open_shared_object'/3: The specified module could not be found.
>> ERROR: c:/program files/swipl/library/jpl.pl:4637:
>>          library `java' does not exist (Please add directory holding
>> java.dll to %WINEPATH%)
>> Warning: c:/program files/swipl/library/jpl.pl:4637:
>>          Goal (directive) failed: jpl:initialization(setup_jvm,now)
>> ERROR: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:1:
>>
>>          Exported procedure jpl:jpl_c_lib_version/1 is not defined
>> %  library(jpl) compiled into jpl 0.06 sec, 2,230 clauses
>> ERROR: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:23:
>>
>>          jpl:jFindClass/2: Undefined procedure: jpl:jni_func/3
>> Warning: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:23:
>>          Goal (directive) failed: user:jpl_text_entry_demo
>> % c:/Program Files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl compiled 0.06 sec, 2,236 clauses
>> Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.4.1)
>> Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam
>> SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
>> and you are welcome to redistribute it under certain conditions.
>> Please visit http://www.swi-prolog.org for details.
>>
>> WINEPATH now has C:\Program Files\Java\jdk1.6.0_43\jre\bin
>>
>> ERROR: c:/program files/swipl/library/jpl.pl:4637:
>>          '$open_shared_object'/3: The specified module could not be found.
>> ERROR: c:/program files/swipl/library/jpl.pl:4637:
>>          library `jvm' does not exist (Please add directory holding jvm.dll
>> to %WINEPATH%)
>> Warning: c:/program files/swipl/library/jpl.pl:4637:
>>          Goal (directive) failed: jpl:initialization(setup_jvm,now)
>> ERROR: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:1:
>>
>>          Exported procedure jpl:jpl_c_lib_version/1 is not defined
>> %  library(jpl) compiled into jpl 0.06 sec, 2,230 clauses
>> ERROR: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:23:
>>
>>          jpl:jFindClass/2: Undefined procedure: jpl:jni_func/3
>> Warning: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:23:
>>          Goal (directive) failed: user:jpl_text_entry_demo
>> % c:/Program Files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl compiled 0.06 sec, 2,236 clauses
>> Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 6.4.1)
>> Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam
>> SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
>> and you are welcome to redistribute it under certain conditions.
>> Please visit http://www.swi-prolog.org for details.
>>
>> Notice the error message has changed. I now add C:\Program
>> Files\Java\jdk1.6.0_43\jre\bin\server to WINEPATH.
>>
>>
>> ERROR: c:/program files/swipl/library/jpl.pl:4637:
>>          '$open_shared_object'/3: The specified module could not be found.
>> ERROR: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:1:
>>
>>          Exported procedure jpl:jpl_c_lib_version/1 is not defined
>> %  library(jpl) compiled into jpl 0.05 sec, 2,232 clauses
>> ERROR: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:23:
>>
>>          jpl:jFindClass/2: Undefined procedure: jpl:jni_func/3
>> Warning: c:/program files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl:23:
>>          Goal (directive) failed: user:jpl_text_entry_demo
>> % c:/Program Files/swipl/doc/packages/examples/jpl/prolog/
>> jpl_text_entry_demo.pl compiled 0.05 sec, 2,238 clauses
>>
>>
>> The jvm.dll error goes away although I still get the jvm.dll popup error
>> message.
>>
>> In your message you say that the registry is used to find things. Do you
>> mean the windows registry? The documentation says to use CLASSPATH/PATH
>> environment variables. Is there something in the windows registry that also
>> comes into play?
>>
>> Thanks!
>>
>> Jerry
>>
>>
>>
>>
>>
>> On Wed, Jul 31, 2013 at 6:45 PM, Paul Singleton <[email protected]> wrote:
>>
>>> On 31/07/2013 20:59, Jerry wrote:
>>>
>>>> There may be a problem with JPL in the current stable release. I have
>>>> been
>>>> successfully using JPL since early July. Today, I uninstalled the 64 bit
>>>> windows version and reinstalled it as I was trying to determine if I had
>>>> a
>>>> good compiled version of my application. At this point my application was
>>>> no longer able to initialize java. I have a compiled version from earlier
>>>> today that works. That was compiled with a 64 bit prolog version that I
>>>> downloaded earlier this month. I can run the earlier compiled version and
>>>> then go to the jpl examples from the packages directory which do not run.
>>>> That implies all the environment variables are pointing to the right
>>>> places.
>>>>
>>>> Here is the error I am getting:
>>>>
>>>
>>> If you start a fresh instance of SWI-Prolog (console or win) and do
>>>
>>> ?- jpl_new('java.util.Date', [], X).
>>>
>>> (or anything which wakes JPL up), you should see a message from Jan
>>>
>>> % Added [C:\Program Files\Java\jdk1.7.0_17\jre\**bin\client,C:\Program
>>> Files\Java\jdk1.7.0_17\jre\**bin,C:\Program Files\Java\jdk1.7.0_17\bin]
>>> to %PATH%
>>>
>>> What do you see, and does it make sense?
>>>
>>> I think Jan gets these paths from the registry; if you then see a popup
>>> saying jvm.dll cannot be found, they may be wrong, perhaps because of an
>>> incomplete un/reinstallation of a JRE?
>>>
>>> Paul Singleton
>>>
>>>
>>>   ERROR: c:/program files/swipl/library/jpl.pl:**4637 <http://jpl.pl:4637>
>>>> :
>>>>           '$open_shared_object'/3: The specified module could not be
>>>> found.
>>>> ERROR: c:/program files/swipl/doc/packages/**examples/jpl/prolog/
>>>> jpl_versions_demo.pl:1:
>>>>           Exported procedure jpl:jpl_c_lib_version/1 is not defined
>>>> %  library(jpl) compiled into jpl 0.05 sec, 2,232 clauses
>>>> ERROR: c:/program files/swipl/doc/packages/**examples/jpl/prolog/
>>>> jpl_versions_demo.pl:22:
>>>>           jpl:jFindClass/2: Undefined procedure: jpl:jni_func/3
>>>> Warning: c:/program files/swipl/doc/packages/**examples/jpl/prolog/
>>>> jpl_versions_demo.pl:22:
>>>>           Goal (directive) failed: user:jpl_versions_demo
>>>> % c:/Program Files/swipl/doc/packages/**examples/jpl/prolog/
>>>> jpl_versions_demo.pl compiled 0.05 sec, 2,238 clauses
>>>> I also get a popup stating that jvm.dll cannot be found. As stated, the
>>>> earlier compiled version runs fine. I looked for earlier versions of 64
>>>> bit
>>>> windows and the earliest I saw was from July 24th. I tried that one and
>>>> got
>>>> the same error.
>>>>
>>>> Any ideas?
>>>> Thanks!
>>>>
>>>> Jerry
>>>> -------------- next part --------------
>>>> HTML attachment scrubbed and removed
>>>> ______________________________**_________________
>>>> SWI-Prolog mailing list
>>>> [email protected].**de <[email protected]>
>>>> https://lists.iai.uni-bonn.de/**mailman/listinfo.cgi/swi-**prolog<https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog>
>>>>
>>>>
>>>
>>
> -------------- next part --------------
> HTML attachment scrubbed and removed
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.