View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014689CMakeCMakepublic2014-01-08 22:522016-06-10 14:31
ReporterLarry Shaffer 
Assigned ToKitware Robot 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformAppleOSMac OS XOS Version10.6-10.9
Product VersionCMake 2.8.12 
Target VersionFixed in Version 
Summary0014689: Leaverage /usr/libexec/java_home to help FindJava and FindJNI modules on Mac 10.6-10.9
DescriptionMac has a utility, /usr/libexec/java_home, which returns the currently defined home for the system, similar to setting JAVA_HOME environment variable. Most users have always used the JavaVM.framework provided by Apple, but with Mac OS X 10.9 Apple no longer readily provides one (though a user may have a previous install lingering), but instead prompts users to download and install the latest from Oracle.

To get FindJava and FindJNI modules to work on Mac, you usually have to set JAVA_HOME in the environment first, if you want to use a non-Apple Java install, e.g. Oracle's, even though /usr/libexec/java_home now correctly points to the non-Apple install. Also, if a user installs the Oracle Java, but still has a lingering previous Apple install, FindJNI returns mixed results unless CMAKE_FIND_FRAMEWORK = LAST (FIRST by default).

It is not difficult to determine an Apple Java.framework install, when returned by /usr/libexec/java_home, since they all have a 'bundle' symlink in their root directory, while non-Apple installs do not.
Steps To ReproduceTest project attached. Run on a Mac with a non-Apple Java install, without setting JAVA_HOME environment variable.

If you have a lingering Apple Java install, it overrides and the non-Apple Java is ignored.

If you have both an Apple JavaVM.framework and a non-Apple Java install, setting JAVA_HOME environment variable still does not fully work with Find modules, since CMAKE_FIND_FRAMEWORK defaults to FIRST and Apple's framework components are often found instead.
Additional InformationWill be setting up a github.com pull request with changes that fix these issues.
Tagsjava, jni, macosx
Attached Filestxt file icon CMakeLists.txt [^] (5,064 bytes) 2014-01-08 22:52 [Show Content]

 Relationships

  Notes
(0034917)
Larry Shaffer (reporter)
2014-01-08 23:00

github.com pull request:
https://github.com/Kitware/CMake/pull/80 [^]

as patch:
https://github.com/Kitware/CMake/pull/80.patch [^]
(0035030)
Brad King (manager)
2014-02-03 15:14

Changes made for this issue:

 Find{Java,JNI}: Use ENV{JAVA_HOME} first when set
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b3614b2 [^]

 Find{Java,JNI}: Consider JAVA_HOME before ENV{JAVA_HOME}
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fcd66a7f [^]

 FindJNI: Overhaul finding JDK libraries and headers on OS X
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=70560ee1 [^]

 Find{Java,JNI}: Use /usr/libexec/java_home on OS X
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dd72b19f [^]

Follow-up discussion on cmake-developer's list:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/9226 [^]
(0042461)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2014-01-08 22:52 Larry Shaffer New Issue
2014-01-08 22:52 Larry Shaffer File Added: CMakeLists.txt
2014-01-08 22:54 Larry Shaffer Tag Attached: macosx
2014-01-08 22:54 Larry Shaffer Tag Attached: java
2014-01-08 22:54 Larry Shaffer Tag Attached: jni
2014-01-08 23:00 Larry Shaffer Note Added: 0034917
2014-02-03 15:14 Brad King Note Added: 0035030
2016-06-10 14:29 Kitware Robot Note Added: 0042461
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team