Closed maxime-carbonneau closed 7 years ago
Short answer => you didn't install Java with OSX standard. If Java was installed by the correct way, /usr/libexec/java_home shows the right path to Java. Of course Rjb obeys Apple standard.
According to your answer, I didn't express myself correctly. /usr/libexec/java_home was showing /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home has expected. But, Rjb::import('anything') didn't work until I install Java6. And now, /usr/libexec/java_home still show /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
What files in the directory? Are there valid Java system? Or you may set JAVA_HOME environmental variable. Rjb checks the variable prior reading /usr/libexec/java_home for overriding testing Java environment.
I try with and without JAVA_HOME. JAVA_HOME was set in my .bash_profile like this : export JAVA_HOME=$(/usr/libexec/java_home) jdk1.8.0_121 was installed with the installer downloaded from Oracle (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) I pretty sure I did it the "correct" way
Why do you think it as correct way of Apple? I think it's correct way of Oracle.
Umm, I also use Orcale Java.
irb(main):001:0> require 'rjb' => true irb(main):002:0> sys = Rjb::import('java.lang.System') => #<Rjb::Java_lang_System:0x007ffae88af3c8 @user_initialize=nil> irb(main):003:0> sys.property('java.version').to_s => "1.8.0_20" irb(main):004:0> sys.property('java.vendor').to_s => "Oracle Corporation"
They changed their way between 1.8.0.20 and 1.3.0.121
I use the word "correct" because you wrote
If Java was installed by the correct way
I just don't understand why do I need to install Java6 to use your gem. With Java6 (from Apple) and Java8 (from Oracle) on my system, I get the following output
2.3.1 :001 > require 'rjb' => true 2.3.1 :002 > sys = Rjb::import('java.lang.System') => #<Rjb::Java_lang_System:0x007fc06b9f28a0 @user_initialize=nil> 2.3.1 :003 > sys.property('java.version').to_s => "1.8.0_121" 2.3.1 :004 > sys.property('java.vendor').to_s => "Oracle Corporation"
I remembered the case likes yours.
https://bugs.openjdk.java.net/browse/JDK-7131356
Installing JDK6 is correct workaround I think.
I ran into this problem too, and this fixed it for me: https://github.com/arton/rjb/issues/30#issuecomment-66909871
My version info:
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
I had the same issue and was able to fix this.
Environment: macOs Catalina
Root cause:
By default JDK from oracle only enabled the CommandLine
capability but this library needed JNI and possibly more capabilities because of which macOs was suggesting me to install the old version of the Java from Apple which had those capabilities enabled by default.
Fix:
I fixed this issue by adding the following entires to /Library/Java/JavaVirtualMachines/jdk<???>/Contents/info.plist
file under JVMCapabilities
array
I tested this with both java both java 8 and 13
On MacOS X Sierra, with jdk1.8.0_121 install, Rjb::import('anything') will halt the process with the message : No Java runtime present, requesting install. I had to install Java6 from Apple (https://support.apple.com/kb/DL1572) to fix the issue. Why?