Skip to main content

Problem and solution for compiling NetBeans on Mac

Posted by joshy on May 17, 2007 at 8:45 AM PDT

What follows is a particular problem I had compiling NetBeans on my Mac and my solution to it. I'm putting this in my blog not so much for my readers but for the future generations of Google travelers who may stumble across this same issue.

I downloaded a fresh copy of the full NetBeans source and compiled it. This is what I got part-way through the compilation process:

 compile-lib:
    [javac] Compiling 33 source files to
/Users/joshy/Desktop/nb2/db/build/lib-classes
   [repeat]
/Users/joshy/Desktop/nb2/db/libsrc/org/netbeans/lib/ddl/adaptors/DefaultAdaptor.java:37:
org.netbeans.lib.ddl.adaptors.DefaultAdaptor is not
abstract and does not override abstract method
getFunctionParameters(java.lang.String,java.lang.String,java.lang.String,java.lang.String)
in java.sql.DatabaseMetaData
   [repeat] public class DefaultAdaptor implements DatabaseMetaDataAdaptor,
Serializable {
   [repeat]        ^
   [repeat] 1 error
  [nbmerge] Failed to build target: all-db

I suspected this was due to using Java 6 instead of Java 5, since I knew there were some changes to the JDBC spec in Java 6. Switching to 5 didn't fix the problem but I finally figured it out this morning.

To switch your JVM on the Mac you must use the Java Preferences application. You can reorder the JVMs Java Application Runtime Settings area of the main screen. Putting Java 5 first will only fix half of the problem, however. The NetBeans build scripts also use the JAVA_HOME environment variable when you compile from the command line. Normally this is not set on a Mac so changing the order of VMs won't affect it. However, I had manually set JAVA_HOME in my .bash_profile when working on another project. This was still set to Java 6! Changing it to Java 5 fixed my problem and let the compilation complete. Note that you'll need to do an 'ant real-clean' and delete the 'nbbuild/build' directory if you had already partly compiled with Java 6.

So that's it. I hope this helps you.

Related Topics >>