Java Tutorial - Java Script :
NetBeans
NetBeans is Sun’s entry into the open source IDE fray. NetBeans has been around since 2000 and so has a year head start on Eclipse. In practice, this means that NetBeans currently offers much more functionality out of the box
for the programmer.
NetBeans also has a different purpose. Rather than being a platform for developing IDEs, NetBeans is designed to be an application platform or framework that can be used to develop any application. The IDE is just another
application using the NetBeans development framework. Unlike Eclipse, Net- Beans is also strictly standard Java. The user interface is implemented using the swing class. The following table summarizes NetBeans.
Like Eclipse, NetBeans comes configured as a Java development environment when it is downloaded. NetBeans can also be extended by using plugins. However, NetBeans comes with a lot more functionality preinstalled into
the environment than Eclipse provides. Once installed, NetBeans supports the development of Java programs, servlets, JavaServer Pages, XML, and HTML files. NetBeans includes support for the graphical development of Java applications. Many other tools come as part of the standard installation.
NetBeans offers a standard installation program for Windows. Linux and Unix users can either simply extract the tar.gz distribution or run an installer package. After it is installed on Windows, NetBeans provides an icon
on the desktop and entries on the Windows Start menu to launch the IDE.
Creating Hello World in NetBeans
As an introduction to the Netbeans IDE, you will create the same Hello World application that you did with the Eclipse IDE. To start, you need to create a project. This is done by selecting Project ➪Project Manager from the menu and then selecting the New... button. Name the project HelloProject, and click OK.
The Explorer pane on the left of the workbench displays a disk icon representing the root of all file systems. You need to mount a file system for your project. To do this, right-click the drive and choose Mount ➪ Local Directory.
The resulting dialog box can be used to select a directory to host your project (for example, c:\mysrc\helloProject). If there are no directories mounted, you are forced to mount a directory before you can create files for your project. After the directory is mounted, select the directory.
The File ➪ New menu item presents a tree with templates that can be selected to create source code files. Select the Java classes node, expand it, and then select the main node. The description for this node states “Using this template,
you can create a new Java class with a main method permitting it to be run as a console application.” Click next. For the name enter HelloWorld, for the package enter com.wiley.freej2ee.ch4.netbeans, then click Next to go to
the Basic Class Definition screen. You don’t need to do anything here, so you may either click Next to see the other screens in the wizard or just click Finish to start the code generation.
After you click Finish, you will be returned to the workbench. The Explorer pane shown in Figure 4.9 shows the subdirectory structure created to support the package, and the editor pane shows the generated source code. Add the
following line to the main method:
System.out.println(“Hello World”);
Then, choose Build ➪ Compile to compile the program and then choose Build ➪ Execute to run the program.
