Friday, March 31, 2006

 

Using Java 1.5 for Netbeans on Mac OS X

One slightly annoying thing about Mac OS X tiger is that default Java VM is 1.4. That is fine usually but when you launch Netbeans you're stuck with 1.4. So if you want Java 1.5 for use with Netbeans make sure you download Java 1.5 from Apple and then you need to edit the file NetBeans.app/Contents/MacOS/netbeans. In the file you'll need to set or replace "$netbeans_jdkhome" with "/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home " which is the not so obvious home for Apple's 1.5 JDK.

Wednesday, March 29, 2006

 

Faster builds with Netbeans!

I have a probably unhealthy obsession with getting faster build times. What can I say, I am impatient. With the current project I am working on we have an Ant target that is the "mother of all builds" which cleans, builds, and deploys the entire project. On my Sun Blade 1000 it take just under a minute so I try not use it too much for normal development. Since I have switched to Netbeans I mapped my F6 key to run this target. Netbeans gave me a pleasant suprise. The first time I do a build it takes the same amount of time as when I would run Ant from the command line, just under a minute. But the next time I do the build through Netbeans the build takes just around 30 seconds! Yippee!

Plus, I saved myself an entire keystrock because before I used to have alt-tab then up arrow, now it is just a simple F6.

Tuesday, March 28, 2006

 

Put Three Arrays Into One With Java

Ever since I learned about Vector in Java 1.0 I never wanted to touch an array again. But I had to today. I needed to concatenate three arrays into one. Here is a non-obvious elegant way:

System.arraycopy(array1, 0, finalArray, 0, array1.length);
System.arraycopy(array2, 0, finalArray, array1.length, array2.length);
System.arraycopy(array3, 0, finalArray, (array1.length+array2.length), array3.length);

That sure beats a bunch of for loops.

Tuesday, March 21, 2006

 

Solaris Express, build 34 upgrade

Last night I upgraded to build 34, no problems like I had with build 33. But one thing I realized is that I am getting really sick of redoing my network and time zone setings everytime I do an upgrade, I think there has to be a better way...

 

Swing is easy, but Swing is hard

This is in response to mellia's comment and I felt deserved an entire new posting.

One of the biggest complainants about Swing is that it is too hard. I believe this is because people expect Swing to be some kind of RAD GUI building tools some other "high level" languages. After all, so many other things are easy in Java. But Swing is no RAD tool, it was meant to be a full featured API. If you think Swing is hard then try to making a desktop app using C/C++ and the Motif library and then make it run on Windows too, now that would be tedious. That is really what Swing was trying to improve upon.

If you are looking for tools to help with saving time building Swing apps, I really y like Netbeans Matisse. It is the first Swing GUI builder that I ever really liked.

And yes you can use Swing to build "real" apps. Netbeans is an example.

Friday, March 17, 2006

 

Java Webstart - Beware of the Cache!

Java Webstart is a great technology. But watch out for your apps getting cached! In beta testing a small bug was found that screwed up data that I promptly fixed and deployed to the web server. The problem is that the user's were still running off the beta version cached on their local machines which screwed up lots of data. Think of a database that stores prices. The list price was getting over written with the cost instead. This would make customers happy since they could buy stuff at cost but not my bosses for obvious reasons! Making the user go in the control panel and clear the cache to straighten up the beta in production and creative use of JDBC/SQL fixed the data in a hurry saved my butt.

 

Netbeans back in my toolbox

Netbeans and I go way back, since around 2000. But about a year ago I go real frustrated with it for a couple of reasons. So I decided to try some other tools out to see what I might have been missing. My favorite was Emacs with JDEE. But recently I needed to do a Swing app so I tried out Netbeans 5.0. It is much better and is the best Java GUI builder I have ever used. The rest seems pretty good to. But Emacs won't be going away that's for sure. I will still use it as my "side-arm" editor. I just wish Netbeans could accept some Emacs keybindings.

Saturday, March 04, 2006

 

Getting Started with OpenSolaris using VMWare

The final version of my article "Getting Started with OpenSolaris using VMWare" has been posted on the OpenSolaris site. This is a great way to try out OpenSolaris to see what it's all about.

This page is powered by Blogger. Isn't yours?