< Zurück | Inhalt | Weiter >

10.2.2 Installing NetBeans

NetBeans can be downloaded from the netbeans.org Web site. You will want the NetBeans “IDE” and not the NetBeans “platform.” The IDE is the fully featured Java development environment. The platform is the underlying core of NetBeans on top of which one can develop other tools—for example, IDEs for other languages. Installation of the IDE consists of only three steps:

1. Download.

2. Install.

3. Execute. Downloading

The first step is to get the software downloaded onto your system. From the netbeans.org Web site, navigate your way to a download of the latest IDE. The prepackaged “installers” might work—but if they fail, you have no infor- mation as to why, and still less as to what you can do about it. We’ll act like “real programmers” and download an archive file. (Here “archive” means a collection of software compressed for easier transmission, not “archive” in the sense of “old documents.”) Click on a link to begin the download (you’ll need to read, review, and accept the license agreement to proceed). The result should be a file on your system named something like NetBeansIDE-release35.tar.bz2. Installing

The installation consists of three steps: untarring the file, adjusting a parameter in a configuration file, then creating a symbolic link for easy startup.2


2. Thanks to John Zoetebier from New Zealand for his contribution on the NetBeans users mailing list, on which this manual installation procedure is based.

Uncompress the archive:

bunzip2 NetBeansIDE-release35.tar.bz2

This will leave the file NetBeansIDE-release35.tar in place of the

.bz2 file.

You can examine the contents of the TAR file with:

tar -tvf NetBeansIDE-release35.tar | more

Here the options (-tvf) specify to show a table of contents (-t) in ver- bose, that is, long, form (-v) from the specified file (-f) followed by the TAR filename. The output from tar here is piped into more so that you can page through it. Type q when you’ve seen enough, or leave off the | more to let it run through without pausing.

Notice that the names of all the files in the TAR archive begin with netbeans/ which tells us that if we untar the file, it will put all the files into a directory called netbeans. Therefore, we don’t need to make such a folder beforehand.

Change directory to the directory where you would like to install NetBeans. If you are on a system that may be used by different users, you’ll probably want to put it in a more public location like /usr/local or /opt. If it is for your personal use, you can put it anywhere—just be sure that you have write permissions on the directory where you want to install NetBeans. (Reminder: use ls -ld . to see the permissions of the current directory.)

The tar command to untar everything in place is simple:

tar -xf NetBeansIDE-release35.tar

This will extract (-x) all the files that are in the TAR file (-f) named NetBeansIDE-release35.tar. If you’d like to see each file get named as it is extracted, then change the -xf to -xvf (v for verbose) and you will see a whole long list of filenames displayed on your screen as the file is unpacked.

Next, we need to adjust the startup parameter in the configuration file. The file is in the netbeans directory that you just untarred. In there is a direc- tory named bin, and in there is a file called ide.cfg. Open this file with an editor and change the line that begins -jdkhome so that the pathname refers to the location of your Java Development Kit (JDK, see Chapter 5).

Here’s an example of the contents of ide.cfg:

-J-Xms24m -J-Xmx96m


-jdkhome /usr/local/java/j2sdk1.4.1_01

This specifies that the Java SDK is located in /usr/local/java/ j2sdk1.4.1_01, and in that directory there is a bin directory which contains java, javac, javadoc, and so on.

Finally, to make the executable easy to run, we will construct a symbolic link for easy access:

$ ln -s /usr/local/netbeans/bin/runide.sh /usr/local/bin/nb

This creates a symbolic link from the runide.sh file in the current directory to the /usr/local/bin directory, as a file named nb. Running

Now that you have the symbolic link to the script which runs NetBeans, simply invoke it with nb at a shell prompt. NetBeans will start loading (Figure 10.1). If you get a message like “Command not found,” check to see if the shell knows where to look. If you used the same name and location as in the previous example, then make sure that /usr/local/bin is part of the search path for the shell. (Reminder: echo $PATH will tell you what directories are searched.

If you need to, add /usr/local/bin to PATH, as in:


Figure 10.1 NetBeans begins


Figure 10.2 NetBeans’ main window

export PATH="${PATH}:/usr/local/bin"

which you can type from the command line for immediate use and then put in the .bashrc file in your home directory to set things this way next time you invoke a shell.)

Also be sure that the script runide.sh has execute permissions on it. (Reminder: check this with ls -l runide.sh and change with chmod a+x runide.sh.)

If all goes well then after the splash screen, you should see the window shown in Figure 10.2.

For more information on installing NetBeans, check out


Now let’s take a look at how you might use NetBeans.