octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need test of patch for OS X


From: Alexander Hansen
Subject: Re: Need test of patch for OS X
Date: Tue, 10 May 2016 13:00:01 -0700

> On May 10, 2016, at 12:27, John W. Eaton <address@hidden> wrote:
> 
> On 05/10/2016 03:00 PM, Ben Abbott wrote:
> 
>> I don’t think there is a standard JVM install for Mac OS X. Perhaps that is 
>> why OS X is handled differently?
> 
> I don't think there is a standard JVM install for anything. Except maybe 
> Windows? But I'm not sure.
> 
>> Even so, I’d prefer that everything depend upon JAVA_HOME at run time. That 
>> would make it much simpler to tweak things and get Octave+Java to play nice 
>> with Mac OS X.
> 
> That's what I'm trying to do and on other systems we are pretty close to that 
> already.  We are doing something like this (omitting casts and some other 
> details):
> 
>  octave_shlib lib (jvm_lib_path);
> 
>  create_vm_fptr_t create_vm_fcn = lib.search ("JNI_CreateJavaVM");
>  get_vm_fptr_t get_vm = lib.search ("JNI_GetCreatedJavaVMs");
> 
> and then using those pointers to call the initialization function. Octave is 
> NOT linked with the JVM.  We just load it as needed.  The only thing is that 
> we are hard-coding the location of the JVM shared library at configure time.  
> That needs to be fixed.
> 
> But for whatever reason, on OS X we ARE linking Octave with the JVM and 
> calling JNI_GetCreatedJavaVMs and JNI_CreateJavaVM directly.  I don't want to 
> do that and I think we should be able to handle this the same on all systems.
> 
> So, loading it doesn't work but linking with it does?  If you build without 
> the patch I sent, do the tests in ov-java.cc pass?
> 
> jwe
> 
> 


Getting away from hardcoding the configure-time JVM location and also getting 
away from linking it would be ideal if you can swing it.  As would getting away 
from using the legacy Java 1.6 Framework.  It’s got a stable location (apart 
from having moved between the 2014 and 2015 versions), but Apple is poised to 
get rid of it altogether.

Personally, dealing with Java on OS X really annoys me, but I’ll go ahead and 
defend it just a bit. :-)

The JDK and associated JVM install on OS X has been vaguely standardized now as 
of some point in the Java-1.7 series:

Fionna-3:~ hansen$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home

Apple hasn't decided to clobber that executable yet, so there is still a 
reliable way to get at the java Home even if JAVA_HOME isn’t set. 

Oracle finally settled on 
/Library/Java/JavaVirtualMachines/jdk<major>_<minor>.jdk after a few earlier 
hiccups.  There are no guarantees with regard to pre-release 1.9 Javas, of 
course.

For whatever inscrutable reason, Oracle’s “just JVM” install for OS X is in a 
completely different location:

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

That’s for 10.11.  I don’t have other versions handy right now to check where 
they install, and there may be some variation.  I also always have a JDK 
installed, so I can’t verify that the runtime Java tools know to point to that 
JVM.

-- 
Alexander Hansen, Ph.D.
Fink User Liaison




reply via email to

[Prev in Thread] Current Thread [Next in Thread]