To add Netbeans to the Unity launcher in Ubuntu 11.10 is unfortunately not as easy as executing the application and click “Stick in launcher”.

Problems:
- If you click on the icon again, it will try to start a new instance of Netbeans. Netbeans will see that it’s already opened, so it will not start another instance, but this way it’s still dirty and slow.
- Unity will forget the link on reboot, so the icon disappears.

To solve these problems, download http://plugins.netbeans.org/plugin/40321/unity-launcher first.

Open Netbeans and go to Tools -> Plugins -> Downloads -> Add plugin. Select the downloaded Unity launcher plugin there and install it. Close Netbeans after installation.

As of Netbeans 7.1 the file described below is automatically created with also the correct permissions. For older versions than Netbeans 7.1 you’ll must proceed with the steps below.

Open a terminal and execute the following:

nano /home/YOURNAME/.local/share/applications/netbeans.desktop

And add the following with some minor changes of your own:

[Desktop Entry]
Name=Netbeans
Comment=Netbeans IDE
Exec=/home/YOURNAME/netbeans-7.0/bin/netbeans
Icon=/home/YOURNAME/netbeans-7.0/nb/netbeans.png
Terminal=false
Type=Application
StartupNotify=true
StartupWMClass=netbeans

Give your user execution rights:

chmod u+x /home/YOURNAME/.local/share/applications/netbeans.desktop

Now reboot your system and everything should work correctly!