Re: Java version used by Jpl (Prolog to Java)
Paulo Moura <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 20/03/2014, at 16:15, Jan Wielemaker <[email protected]> wrote: > 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. It seems so. > You can find that using > > otool -L libjpl.dylib $ otool -L libjpl.dylib libjpl.dylib: /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM (compatibility version 1.0.0, current version 1.0.0) /Users/pmoura/lib/swipl-7.1.10/lib/x86_64-darwin13.1.0/libswipl.dylib (compatibility version 0.0.0, current version 7.1.10) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) /opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) > You can change that using > > install_name_tool -change old new libjpl.dylib > > Hope this helps (otherwise you need a real Apple guru). I tried it but I didn't find any libjvm.dylib library on the Java 7 installation. It may go by a different name. Tried to link instead to libjava.dylib but it didn't work. Thanks for your feedback. Cheers, Paulo ----------------------------------------------------------------- Paulo Moura Logtalk developer Email: <mailto:[email protected]> Web: <http://logtalk.org/> -----------------------------------------------------------------