 |
Problem and solution for compiling NetBeans on Mac
Posted by joshy on May 17, 2007 at 08:45 AM | Comments (5)
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.
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Hey Josh!
Just FYI - You really don't want to be using the Java 6 pre-prerelease with NetBeans (and probably not for many Swing applications). There are several known bugs where the JDK starts painting weird stuff. I really can't wait for a stable Java 6 to be released for the Mac.
Posted by: tnorbye on May 17, 2007 at 09:24 AM
-
Isn't it irritating that JDBC keeps adding methods to interfaces and breaking them all the time instead of creating a new interface that possibly extends the old one?
Posted by: mister__m on May 17, 2007 at 09:28 AM
-
michael - NetBeans has done exactly the same, breaking the Substance module in 6.0...
Posted by: kirillcool on May 17, 2007 at 10:13 AM
-
mister__m. I agree. This is why I hate interfaces and have started using abstract classes for all of my APIs whenever possible.
tnorbye. I agree. Sadly you can't uninstall Java 6 on the Mac so I didn't realize that the build scripts from the commandline were still using 6 instead of 5. After thinking about it for a while I realized there must be some other way it was picking up 6 which is when I thought about the JAVA_HOME var. It was frustrating because typing 'java -version' showed Java 5.
Posted by: joshy on May 17, 2007 at 10:57 AM
-
There are rumours about an imminent release of OS X 10.4.10... but I don't think they will give us Java 6... :-(
Posted by: fabriziogiudici on May 17, 2007 at 11:33 AM
|