Dominic Williams

Occasionally useful posts about RIAs, Web scale computing & miscellanea

Posts Tagged ‘Google code

Build Google Guava on Mac OS X

leave a comment »

Yo if you are a Java programmer and you haven’t heard of Google Guava, then read up!!!

Guava provides numerous classes that make up for various Java standard library deficiencies encountered by people in the RIA space. Generally I’m not a great fan of using third party libraries because of the support and dependency issues, but when it’s the main Java utility library that Google maintains to support its own app developers, I make an exception!) So if you regularly implement things like event listener sinks, don’t reinvent the wheel, just use Guava HashMultiMap (although a ConcurrentWeakHashMultiMap would be nice, but let’s not look a gift horse in the mouth). On a lesser level, this library also comes with things like character processing utilities that make tasks like username validation much simpler.

However on Mac OS X you might have problems building the source – at least with Guava 1.5 – and a jar file isn’t included.

Solution, once inside the guava folder:

1. At your command prompt do:

you$ export JAVA5_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5

2. Using your favorite editor, add the following target to build.xml

<target name="jar" depends="compile">
    <jar destfile="google-guava.jar" basedir="build/classes" />

3. Using your favorite editor, update the java5bootclasspath property

<property name="java5bootclasspath" value="${env.JAVA5_HOME}/Classes/classes.jar"/>

should get yourself a nice google-guava.jar file now.

Written by dominicwilliams

March 17, 2010 at 2:07 pm

Posted in Java, Libraries

Tagged with , , ,