How to Install and Use NetBeans for Java Development
In this guide, I will try to explain you how you can run examples for J2EE tutorials. There are many ways you can do this, here we will be using the examples in NetBeans IDE which is one of the most powerful open source Java integrated development environments available.
The main reason for not selecting another open source IDE like Eclipse is that newest version of NetBeans has built-in free J2EE support. This allows the new users to be able to see the results of examples without any problems and start J2EE development very quickly.
Although the examples are prepared as a NetBeans project, you can still run them in your choice of environment since the codes are prepared are compatible with J2EE standards.
The rest of this guide tries to describe how you can prepare a NetBeans development environment. If you already have an installed NetBeans 4.1 (it should be version 4.1) you can skip this tutorial an open the examples in NetBeans directly. If something does not work with your previous installation, we recommend you to uninstall the previous installation and do a clean install with the instructions in this tutorial.
You need to have Java2 Standard Edition (J2SDK) and NetBeans IDE to be able to run the examples.
If you do not know whether you have a working Java2 Standard Edition or not, please follow the steps written in the second section named as “Installation of J2SDK an NetBeans”
If you have already installed Java2 Standard Edition please read the third section named as “Installation of NetBeans”.
Installation of J2SDK and NetBeans
You first need to install J2SDK from the following address.
Please download “JDK 5.0 Update 3” and do not prefer other downloads like the bundle which contains NetBeans. This is necessary since we need to download NetBeans bundled with Sun Application Server and will download it separately.
The installation instructions of J2SDK 5.0 are available in its download page. Please follow those instructions and install J2SK 5.0 before continuing.
After the installation please read the third section named as “Installation of NetBeans” to install NetBeans on top of J2SDK.
Installation of NetBeans
You need to install NetBeans by following the written below. You will see something like Figure-1 in that page.
You should select your platform from the “Operating System” list and click “Next” button. The next page will be very similar to the one in Figure-2 if you select “Windows” operating system. (A similar page will be shown for Linux users)
Figure-2 NetBeans Installation – Second Page
You should click the “Next” button at the right of the “NetBeans IDE + Application Server 8.1 Bundle Installer” and download the file from the next page. Note that installation instructions are available at this page..
After the installation please read the fourth section named as “How to run examples using NetBeans”.
How to run examples using NetBeans
If you have successfully installed NetBeans you will find an icon on your desktop for NetBeans. When you double click on the NetBeans icon, NetBeans IDE will be opened as shown in Figure-3.
Figure-3 First look of NetBeans IDE
Running J2EE examples after this point is very simple, since we prepared the examples as NetBeans projects. Finding the project folder in “Open Project…” dialog and double clicking on it will open the project in NetBeans. The detailed instructions are written below.
You should select “Open Project…” from the “File“menu. Then you need to find the projects folder where you extracted the “projects-source.zip” file. Figure-4 shows what you will see if you find the projects folder.
Figure-4 Open Project dialog in NetBeans IDE
You will probably notice that project directories seem different than normal directories in the “Open Project…” dialog. After selecting the project directory, clicking on “Open” button will open the project in NetBeans. If you click “Run Main Project” button on the toolbar after the project is opened, the project will be run.