Return to Course Content Home

Installing Java and Netbeans on Linux

Background

There are many variations of Linux, and this install may not cover them all, but...it should cover most of them. You will notice that the instructions are for older versions of Java/Netbeans, but you should get the drift of how to install. If you are using Linux, I am assuming you are comfortable doing a modest amount of sysadmin.

Installing the Java Development Kit (JDK)

Download the Java SDK from https://java.sun.com. On the Sun page, there will be a Java SE link on the right side of the page, select this. You want to choose the Linux self-executing file (jdk-xxx-i586.bin).

Linux Java Version

Once you have downloaded it to your desktop, you need to install it. In this set of screenshots, I have installed it while logged in as root.

Note the steps below:

  1. I want to place it in /usr/local
  2. I set execute permission on the downloaded file
  3. I run the file from the /usr/local directory

Unpacking Java

Once it is unpacked you should be able to see this:

Unpacked Java

I set up links to the jdk so that if I update things later on, I don't need to reset paths

Link to JDK

Now you need to do something just as important, you need tell the system to use this Java as the default. To do so, you use the "alternatives" command.

  1. run the command /usr/sbin/alternatives --install /usr/bin/java java <your path to your java> 2
  2. then run the command alternatives --config java
  3. Select the java you just installed
  4. run "java -version" to make things are okay

Alternatives

At this point you may or may not be done, because there is a bug with Java and newer versions of the kernel. You'll know soon enough when you try to install Netbeans.

Installing the Java Documentation

Go to the Java SE download page at Sun. Toward the bottom of the page there is a Java SE 6 Documentation selection, click on the >>Download button. Accept the license and download the english documentation.

If you don't have the ability to unzip the downloaded file, you can use the jar program in your java installation/bin directory and type jar -xf jdk-6-doc.zip. You should install the zip file in the base java installation directory that you used above.

...and NOW you are done!

Installing the Java EE Tools Bundle with Netbeans 6

Download the Web & Java EE Tools Bundle from https://www.netbeans.org. This bundle includes Netbeans IDE 6.0, the Sun Application Server - GlassFish v2. On the Netbeans download page, there will be a Web & Java EE download button on the the page, select this.

Choose Netbeans

Save out the download, then set the permissions so you can execute the file and unpack it in /usr/local

Unpack netbeans

If you are on Fedora 8, or a new version of the Linux distro, you may/will get the following error at this point.

Unpack error

I'm not going to go into details, suffice to say Linux is updating X windows libraries and Java needs to make a change to work without this error. Fortunately, there is a workaround

Java Fix

Type the set command, and use the directory you installed Java. After you run this command, Java will work fine and you can continue with the Netbeans install with no problems. I'm not going to include every screnshot, but you can see it installs fine.

.