Netbeans and Java JDK on Linux - How to install

If you wish to get started with Java programming on Linux then this article will show you how to install Java and the superb Netbeans integrated development environment (IDE) on your box. Today I downloaded Netbeans 6.9 for Linux and installed it on Linux Mint. I took several screenshots of the process and below I explain the steps involved in case anyone finds it useful and also in case I need to do it again in six months time:-). The Netbeans download also bundles the java software development kit (jdk) for creating applications and the Java runtime engine (jre) for executing them. This routine should work on Ubuntu, Fedora and other versions on Linux


What is involved

Select Java Download All you need to do is download the Netbeans bundle and run a single command in a terminal. It is that simple. First we visit the netbeans website where they offer several download bundles. Options can be a horrible thing when we are not sure what we are doing but as you can see from the sections I have outlined in red that it all looks pretty good so far. We want Netbeans for Linux and want the Java programming version then we are good to go. Click on the thumbnail for a larger view



After selecting our download we save it to a suitable location such as our downloads folder ...


Download Java


Notice that the filename has a .sh extension. This means that the download file is shell script and because it is a script we will need to run the script from the command line. Running a shell script is really easy and all you need to do is type in the letters sh followed by the name of the script. Fire up your terminal, navigate to the download folder and execute the following command:


sh jdk-6u20-nb-6_9-linux-ml.sh


executing a shell script


After running the shell script command we now have two windows open - the terminal and the java installer dialog. The installer dialog will ask us a couple of questions about where we wish to install Java and Netbeans. Make sure to write these locations down in your journal as they are very easy to forget and you will need these de tails at some point in the future if you want to install any other tools or utilities that use java


You can see in the image below that the installer automatically chooses a location under my home directory and that is where I want to be so I just accept this default and follow through by clicking "next" ...


executing a shell script


Next the installer asks us where we want to install the Netbeans IDE and again it offers default suggestions. From the dialog below we can see that it again chooses a location under my home directory and it also tells us that it is going to inform Netbeans on where to look for java ...


netbeans install folder


Next we are given a final chance to verify the folders where Java and Netbeans will be installed ...


netbeans installer running


Now the installer is running and hopefully all with turn out fine ...


netbeans installer running


When the installer has finished you will see a Netbeans launch icon on your desktop. Open Netbeans ...


netbeans installer running


Now that you are all set up and dying to get started I have included a few links below especially for beginners. More experienced developers will know what they are looking for on the Netbeans website but it can be a tad overpowering for beginners. At least that is the way I remember it when I started. There is a link to a hello world program and then after you have created a couple of console applications I know will be dying to build something with a graphical user interface (GUI). The quick start tutorial page contains links to other tutorials you might want to try once you have found your programming feet. Hopefully now that you have seen how easy it is to set up Java and Netbeans on Linux you will enjoy the learning experience very much. Bon Chance.


Netbeans font issues

I use Gnome desktop on Linux and Gnome uses the GTK toolkit for user interfaces but Netbeans menu fonts don't look very nice as you can see from the screenshot below. I experimented and found that the Metal look and feel looks way better on Linux even though this look does not fit in with the rest of the system. However, programming is our main concern here and this is only a small problem. You can easily edit the Netbeans configuration file to instruct Netbeans to adopt the Metal look and feel when the application starts.

netbeans fonts


Setting Metal as the default Netbeans look and feel

In the Netbeans folder you look for the file /etc/netbeans.conf and open it in a text editor. You can see from the screenshot below that there is a section for setting the default configuration for Netbeans and you can see that I have added an extra option to the list. We add a double hyphen followed by the letters laf and the word Metal: "--laf Metal"


netbeans configuration


When you restart Netbeans you will have a nice clean work space.


Links

Netbeans home page Welcome to Netbeans

Tutorial Netbeans IDE Quick start tute - "hello world"

Tutorial Creating GUI applications in Netbeans