Tuesday, 29 January 2008

Netbeans Missing New Project Categories

Jump to solution. (Skip stupid story.)

It was raining outside and it was a dark and said day and there was nothing to work on when I decided to give a try to Netbeans in J2EE development. If you have read my blog before you must know I am an Ubuntu user. Actually not a fan. I am not loving anything easily. But I am in general very satisfied with Ubuntu. I like it very much. Am I a fan? Together with its problem too. But from time to time I am running into problems which can make life harder than .... than is should be. (Life is hard anyway. It does not matter if you are Linux Windows or Mac OS user. So hold on your arguments about it. :) )

Back to the point I have Ubuntu Gutsy which currently contains Netbeans 5.5. So I started it and wanted to start a new project. What a surprise I have seen I could not. There were no menu items besides import existing ant project what I could reach. Holy s.... something! What is this? I was asking.
Tried to purge package and reinstall but no luck. So finally I concluded that the problem is around Netbeans 5.5. What can people do than? I have taken the lattes version Netbeans 6.0 and tried. Much more surprise I had the same situation. No menu to create new project. I started to think about some kind of global conspiracy and decided to unveil it so the day just turned darker.

So first started to Google around. It almost always helps. And I found ideas to delete the ~/.netbeans directory and restart IDE. It did not help me too much. Also find some idea to use different java version. Which also did not help me.
What helped me was deleting ~/.netbeans AND using a Sun java version together. Even java 6 or 5 from Sun. (Anyway you can specify the java version as a netbeans command line parameter like: $ netbeans --jdkome /usr/lib/jvm/java-6-sun )
So I would have sat back and enjoy it. But I wanted to know what was wrong. So first checked that the java version which prevented me to use netbeans was icedtea-java-7. The other thing I had to realize - and primarily made me to investigate it - was that if you ever started netbeans with icedtea-java-7 you can not start it after even with the sun java without deleting ~/.netbeans . This is very uncomfortable since you can loose your settings I decided to find out what was the problem. I do not think that you are interested how I did it but here is the result and how to correct it without loosing your settings.

Solution:
$ rm -rf ~/.netbeans/6.0/config/Modules

Simple right?
If you are missing New Project Templates in Netbeans and you have started netbeans ever with IcedTea Java 7 - or any other "unsupported one" - first use only SUN Java as long as this error is not corrected to run netbeans. I do not know if this is an error in Iced Tea Java or in Netbeans and do not care too much anymore. To correct the problem completely delete ~/.netbeans/6.0/config/Modules and restart Netbenas with a Sun Java. This directory will be recreated and you can enjoy the newly available menus without loosing your settings.

Hope it helped you too.