Quantcast
Channel: techblog » OSX
Viewing all articles
Browse latest Browse all 10

Restarting the AWT Native Event Thread

$
0
0

I recently upgraded my OS X Java development environment to
the Java SE 6 Developer Preview 9 release. After the upgrade I encountered the following error when running code which relied upon the AWT libraries:

seventh-circle$ java AWTExample
2008-04-24 12:15:12.061 java[1035:10b] Apple AWT Startup Exception : *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil
2008-04-24 12:15:12.087 java[1035:10b] Apple AWT Restarting Native Event Thread

Ugoogalizing the stack trace indicated this was a rare but not unknown problem, with no obvious solution. A known unknown, if you will.

After blaming everyone else I retraced my steps and realised that I had changed the CurrentJDK and Current symlinks in /System/Library/Frameworks/JavaVM.framework/Versions to point at 1.6, in a misguided attempt to make this the default version of Java for the shell. Specifically by repointing the Current symlink from A to 1.6 I had broken the Java Native Foundation framework. I reset the symlink and chalked the lost hours up to the arrogance of youth:

cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm Current
sudo ln -s A Current

In summary, if you want to change the default version of Java to 1.6 for a command line process on OS X, I’d recommend using the Java Preferences Application. If you want to be sure add the following to your .bash_profile:

JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH


Viewing all articles
Browse latest Browse all 10

Trending Articles