Re: Java version used by Jpl (Prolog to Java)

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 03/20/2014 04:01 PM, Paulo Moura wrote:
>
> On 19/03/2014, at 00:03, Sergio Castro <[email protected]> wrote:
>
>> I have just realized that the Java version used by JPL (Prolog side) is not the one configured by default.
>>
>> My installed Java version is 7, as verified with:
>>
>> $ java -version
>> java version "1.7.0_51"
>> Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
>> Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
>>
>> Also, the JAVA_HOME environment var is properly set.
>>
>> However, if I execute this query in swi:
>>
>> ?- jpl_call( class([java,lang],['System']), 'getProperty', ['java.version'], V).
>> V = '1.6.0_65'.
>>
>>
>> I see that it is using Java 6 instead of 7. How could I fix it so it will use the default java installation ?
>
> I can reproduce the problem with SWI-Prolog 7.1.10. But the strange thing is that in the "packages/jpl/config.log" file I have:
>
> JAR='/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/jar'
> JAVA='/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java'
> JAVAC='/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/javac'
> JAVACFLAGS='-source 1.4 -target 1.4'
> JAVADOC='/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/javadoc'
> JAVALIBS='-Wl,-framework,JavaVM'
> JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home'
> JAVA_LIBRARY_PATH=''
> JAVA_PRELOAD=''
> JPLCFLAGS='-I'\''/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include'\'' -I'\''/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include/darwin'\'''
>
> Nevertheless, I also get:
>
> ?- jpl:jpl_call('java.lang.System',getProperty,['java.version'],_G1413)
> V = '1.6.0_65'.
>
> So, it seems that JPL is built using Java 7 but at runtime it starts (the Apple provided and installed under /System) Java 6.

I guess the final VM is decided by what is linked to libjpl.dylib.
You can find that using

	otool -L libjpl.dylib

You can change that using

	install_name_tool -change old new libjpl.dylib

Hope this helps (otherwise you need a real Apple guru).

	Cheers --- Jan
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.