Closed gissuebot closed 9 years ago
Original comment posted by ruhe.dev on 2010-02-28 at 01:41 PM
There is a good tip about how to fix such problem on Mac OS http://blogs.sun.com/bobby/entry/tip_installing_jdeveloper_on_mac
Also it can be fixed by adding more rules to build file. The only thing I don't understand is - why it requires exactly java 1.5 version. Maybe it would be better to do something like this? <condition property="isJavaHomeSetRight"> <and> <or> <equals arg1="${java.specification.version}" arg2="1.5" /> <equals arg1="${java.specification.version}" arg2="1.6" /> </or> /* task to check rt.jar */ </and> </condition>
Original comment posted by home.melissa on 2010-03-17 at 01:44 PM
Step 1: Update the problem line in your build.xml to: <property name="java5bootclasspath" value="${env.JAVA5_HOME}/Classes/classes.jar"/>
Step 2: you$ export JAVA5_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5
Step 3: you$ ant compile
Will make a blog entry with more detail ria101.wordpress.com
Original comment posted by jacobly@google.com on 2010-03-29 at 03:57 AM
I had equal luck simply removing the bootclasspath="${java5bootclasspath}" attribute from the javac directive. That worked for me with the default Java 1.5 installation on OS X Leopard. I'm not quite sure why build.xml is structured to require JAVA5_HOME to be set.
Original comment posted by kevinb@google.com on 2010-03-30 at 12:07 AM
I trust this issue should become moot once we're providing you with a binary JAR you can just use?
Original comment posted by blair-ol...@orcaware.com on 2010-03-30 at 03:33 AM
Maybe, sometimes I like to build new jars off of an unreleased svn revision (say you want a jar with a bug fix or some new feature), so it would be nice to generally leave the capability there to build a jar at any time.
Original comment posted by kevinb@google.com on 2010-04-23 at 08:34 PM
If someone wants to send a build.xml patch to allow -DpathToRtJar, which would default to the current location if not set, that would be fine.
Original comment posted by schlosna on 2010-05-01 at 03:00 AM
Here's a patch for build.xml to support Apple's JDK layout in addition to the standard Sun/Oracle/OpenJDK layout. Unfortunately on OS X 10.6+, there is no actual JDK 5 as it is actually just a symlink to JDK 6, so this doesn't give the same guarantees of JDK5 API compatibility desired by using the javac bootclasspath. I've included some examples of building on Mac OS X 10.6.3 with Apple's 1.6.0_17 as well as building with soylatte JDK 6 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00. I haven't tested this on other platforms, but I believe it should work.
You can either set JAVA5_HOME to /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/ and it will use /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Classes/classes.jar for the bootclasspath, or you can pass the bootclasspath explicitly -Djava5bootclasspath=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Classes/classes.jar to ant.
The guava sources do appear to use Java 6 specific features such as @Override for interface implementations, so it seems the assumption is that the JDK version used to run Ant's javac must be JDK 6; however, the actual desired binary compatibility is for JDK 5.
Thanks for guava and collections. Hope this helps someone else out.
Apple Mac OS X 10.6+ Java versions: $ ls -ahlF /System/Library/Frameworks/JavaVM.framework/Versions/1.5 lrwxr-xr-x 1 root wheel 10 Dec 4 18:31 /System/Library/Frameworks/JavaVM.framework/Versions/1.5 -> CurrentJDK/
$ ls -ahlF /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK lrwxr-xr-x 1 root wheel 3 Dec 4 18:31 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK -> 1.6/
$ ls -ahlF /System/Library/Frameworks/JavaVM.framework/Versions/1.6 lrwxr-xr-x 1 root wheel 5 Dec 4 18:31 /System/Library/Frameworks/JavaVM.framework/Versions/1.6 -> 1.6.0/
$ ls -ahlF /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0 total 0 drwxr-xr-x 8 root wheel 272 Mar 23 08:23 ./ drwxr-xr-x 13 root wheel 442 Dec 4 18:32 ../ drwxr-xr-x 12 root wheel 408 Dec 4 18:31 Classes/ drwxr-xr-x 41 root wheel 1.4K Dec 4 18:31 Commands/ drwxr-xr-x 12 root wheel 408 Jan 29 23:04 Headers/ drwxr-xr-x 11 root wheel 374 Dec 4 18:31 Home/ drwxr-xr-x 48 _update_sharing wheel 1.6K Dec 4 18:31 Libraries/ drwxr-xr-x 23 root wheel 782 Dec 4 18:31 Resources/
$ JAVA5_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/ ant clean compile Buildfile: build.xml
clean: [delete] Deleting directory /Users/david/Documents/dev/guava/build
compile: [mkdir] Created dir: /Users/david/Documents/dev/guava/build/classes [echo] Using java5bootclasspath: /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Classes/classes.jar [javac] Compiling 220 source files to /Users/david/Documents/dev/guava/build/classes
BUILD SUCCESSFUL
$ JAVA5_HOME=/Users/david/Documents/dev/jdk/soylatte16-i386-1.0.3 ant clean compile Buildfile: build.xml
clean: [delete] Deleting directory /Users/david/Documents/dev/guava/build
compile: [mkdir] Created dir: /Users/david/Documents/dev/guava/build/classes [echo] Using java5bootclasspath: /Users/david/Documents/dev/jdk/soylatte16-i386-1.0.3/jre/lib/rt.jar [javac] Compiling 220 source files to /Users/david/Documents/dev/guava/build/classes
BUILD SUCCESSFUL
$ ant -Djava5bootclasspath=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Classes/classes.jar clean compile Buildfile: build.xml
clean: [delete] Deleting directory /Users/david/Documents/dev/guava/build
compile: [mkdir] Created dir: /Users/david/Documents/dev/guava/build/classes [echo] Using java5bootclasspath: /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Classes/classes.jar [javac] Compiling 220 source files to /Users/david/Documents/dev/guava/build/classes
BUILD SUCCESSFUL
$ ant -Djava5bootclasspath=bad.jar clean compile Buildfile: build.xml
clean: [delete] Deleting directory /Users/david/Documents/dev/guava/build
compile: [mkdir] Created dir: /Users/david/Documents/dev/guava/build/classes
BUILD FAILED /Users/david/Documents/dev/guava/build.xml:43: JAVA5_HOME must be set to a valid JDK 1.5 installation, containing a jre/lib/rt.jar file
Original comment posted by kevinb@google.com on 2011-01-27 at 02:05 PM
(No comment entered for this change.)
Labels: Type-Task
Original comment posted by fry@google.com on 2011-01-28 at 03:58 PM
(No comment entered for this change.)
Status: Accepted
Original comment posted by kevinb9n on 2011-01-28 at 09:04 PM
D'oh -- I fixed this a long time ago and never told anyone.
-Djava5bootclasspath=/full/path/to/that.jar
Status: Fixed
Original issue created by blair-ol...@orcaware.com on 2010-02-20 at 06:04 AM
Trying to build Guava on my Mac OS X 10.6 system using the following command fails because Apple doesn't have an explicit rt.jar in it's 1.5 home directory.
$ JAVA5_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home ant Buildfile: build.xml
compile: [mkdir] Created dir: /Users/blair/Code/Sony/google-guava.git/build/classes
BUILD FAILED /Users/blair/Code/Sony/google-guava.git/build.xml:17: JAVA5_HOME must be set to a valid JDK 1.5 installation, containing a jre/lib/rt.jar file