You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/10/05 23:50:09 UTC

svn commit: r1394830 - in /buildr/trunk: CHANGELOG lib/buildr/java/rjb.rb

Author: donaldp
Date: Fri Oct  5 21:50:08 2012
New Revision: 1394830

URL: http://svn.apache.org/viewvc?rev=1394830&view=rev
Log:
BUILDR-655 - Support JDK1.5 under OSX. Do this by ensuring that the JVM_LIB environment variable is set prior to requiring RJB

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/rjb.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1394830&r1=1394829&r2=1394830&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri Oct  5 21:50:08 2012
@@ -1,4 +1,5 @@
 1.4.8 (Pending)
+* Fixed:  BUILDR-655 - Support JDK1.5 under OSX
 * Change: Updated dependency versions;
           - builder (3.1.3)
           - highline (1.6.15)

Modified: buildr/trunk/lib/buildr/java/rjb.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/rjb.rb?rev=1394830&r1=1394829&r2=1394830&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/rjb.rb (original)
+++ buildr/trunk/lib/buildr/java/rjb.rb Fri Oct  5 21:50:08 2012
@@ -13,6 +13,20 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
+if RbConfig::CONFIG['host_os'] =~ /darwin/i
+  # On OS X we attempt to guess where JAVA_HOME is, if not set
+  # We set JAVA_HOME early so we can use it without calling Java.load first.
+  ENV['JAVA_HOME'] ||= '/System/Library/Frameworks/JavaVM.framework/Home'
+
+  if ENV['JAVA_HOME']
+    # For JDK1.7 this file exists. We need to ensure JVM_LIB is set before loading rjb
+    # As RJB uses it to determine which library to load.
+    # SEE https://github.com/arton/rjb/issues/12#issuecomment-9179415
+    if File.exist?("#{ENV['JAVA_HOME']}/jre/lib/server/libjvm.dylib")
+      ENV['JVM_LIB'] = "#{ENV['JAVA_HOME']}/jre/lib/server/libjvm.dylib"
+    end
+  end
+end
 
 require 'rjb'
 
@@ -72,10 +86,6 @@ module Java
 
   end
 
-  # On OS X we know where the default JDK is. We can try to guess for other OS.
-  # We set JAVA_HOME early so we can use it without calling Java.load first.
-  ENV['JAVA_HOME'] ||= '/System/Library/Frameworks/JavaVM.framework/Home' if RbConfig::CONFIG['host_os'] =~ /darwin/i
-
   class << self
 
     # Returns the classpath, an array listing directories, JAR files and