Rahul's Blog

Archive for September 24th, 2010

First Program in NetBeans IDE:

This post provides step wise procedure to create first program in the NetBeans IDE through the creation of a simple “Hello World” Java console application. Once you have gone with this post, you will have a general knowledge of how to create, build, and run applications in the IDE.

Setting Up the Project

To create an IDE project:

  1. Start NetBeans IDE
  2. In the IDE choose File -> New Project, as shown in the screenshot below.

3. In the New Project wizard, expand the Java category and select Java Application as shown below. Then click Next.

5. In the Name and Location page of the wizard, do the following (as shown in the figure below):

  • In the Project Name field, type MyFirstApplication.
  • Leave the Use Dedicated Folder for Storing Libraries checkbox unselected.
  • In the Create Main Class field, type myfirstapplication.MyFirstApplication.
  • Leave the Set as Main Project checkbox selected.

5. Click Finish

The project is created and opened in the IDE. You should see the following components:

  • The Projects window, which contains a tree view of the components of the project, including source files, libraries that your code depends on, and so on.
  • The Source Editor window with a file called MyFirstApplication.java open.
  • The Navigator window, which you can use to quickly navigate between elements within the selected class.

Adding Code to the Generated Source File

Because you have left the Create Main Class checkbox selected in the New Project wizard, the IDE has created a skeleton class for you. You can add the “Hello World!” message to the skeleton code by replacing the line:

// TODO code application logic here

with the line:

System.out.println(“Hello NetBeans User Group, Nagpur!”);

System.out.println(“This is my first application in NetBeans IDE”);

Save the change by choosing File > Save.

The file should look something like the following:

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package myfirstapplication;

/**

*

* @author Administrator

*/

public class MyFirstApplication {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

System.out.println(“Hello NetBeans User Group, Nagpur!”);

System.out.println(“This is my first application in NetBeans IDE”);

}

}

Compiling the Source File

To compile your source file, choose Run > Build Main Project from the IDE’s main menu or just press F11 shortcut key.

You can view the output of the build process by choosing Window > Output > Output.

The Output window opens and displays output similar to what you see in the following screen.

If the build output concludes with the statement BUILD SUCCESSFUL, congratulations! You have successfully compiled your program!

If the build output concludes with the statement BUILD FAILED, you probably have a syntax error in your code. Errors are reported in the Output window as hyper-linked text. Click such a hyper-link to navigate to the source of an error. You can then fix the error and once again compile your code.

When you build the project, the bytecode file MyFirstApplication.class is generated. You can see where the new file is generated by opening the Files window and expanding the MyFirstApplication/build/classes/myfirstapplication node as shown in the following figure:

Now that you have built the project, you can run your program.

Running the Program

From the IDE’s menu bar, choose Run > Run Main Project or press the shortcut key F6.

The next figure shows what you should now see.

Congratulations! Your first program in NetBeans IDE works!

Downloading  Netbeans IDE:

In this post we will download & install stable version of NetBeans

To download NetBeans, go through the following link:

http://netbeans.org/downloads/index.html

The page will show the different NetBeans IDE Bundles which are available for download. It will be better to select the bundle which has already all the plugins. The below is the screenshot to download NetBeans 6.9.1 version

Installing NetBeans IDE:

After the download is completed, now it’s time to install the NetBeans IDE. Just open the downloaded setup of NetBeans IDE. In this post I am installing NetBeans IDE 6.8, the window will appear:

The NetBeans IDE 6.8 installs various packs and runtimes on your system. By default NetBeans IDE installs “Sun GlassFish Enterprise Server”. If you want to install or uninstall any packs aur runtimes in your system, just click on the Customize button and Customize installation window appears:

Select the required packs from the list and click OK button

Click Next Button & Accept the license agreement and click Next. The next window will appear, the next window shows two field:

  1. 1. First field is the path where the NetBeans IDE 6.8 will install on your hard drive
  2. 2. Second field is the path of the Java Development Kit for the NetBeans

Note: It is important to first install the latest version of the Java Development Kit (JDK) on your system before installing any version of NetBeans.

After the click on the Install button the NetBeans IDE will start its installation on your system

After the installation gets complete click on the Finish button.

Congratulations! You have successfully installed NetBeans IDE in your system.

Introduction:

NetBeans refers to both a platform framework for Java desktop applications, and an integrated development environment (IDE) for developing with Java,JavaScript, PHP, Python, Ruby, Groovy, C, C++, Scala, Clojure, and others.

The NetBeans IDE is written in Java and runs everywhere where a JVM is installed, including Windows, Mac OS, Linux, and Solaris. A JDK is required for Java development functionality, but is not required for development in other programming languages.

Netbeans IDE logo

Current Versions:

NetBeans IDE 6.0 introduced support for developing IDE modules and rich client applications based on the NetBeans platform, a Java Swing GUI builder (formerly known as “Project Matisse”), improved CVS support, Weblogic 9 and JBoss 4 support, and many editor enhancements. NetBeans 6 is available in official repositories of major Linux distributions.

NetBeans IDE 6.5, released in November 2008, extended the existing Java EE features (including Java Persistence support, EJB 3 and JAX-WS). Additionally, theNetBeans Enterprise Pack supports development of Java EE 5 enterprise applications, including SOA visual design tools, XML schema tools, web services orchestration (for BPEL), and UML modeling. The NetBeans IDE Bundle for C/C++ supports C/C++ development.

The NetBeans IDE 6.8 is the first IDE to provide complete support of Java EE 6 and the GlassFish Enterprise Server v3. Developers hosting their open-source projects onkenai.com additionally benefit from instant messaging and issue tracking integration and navigation right in the IDE, support for web application development with PHP 5.3 and the Symfony framework, and improved code completion, layouting, hints and navigation in JavaFX projects.

NetBeans IDE 6.9, released in June 2010, added support for OSGi, Spring Framework 3.0, Java EE dependency injection (JSR-299), Zend Framework for PHP, and easier code navigation (such as “Is Overridden/Implemented” annotations), formatting, hints, and refactoring across several languages.

Features:

The NetBeans IDE is an open-source integrated development environment. NetBeans IDE supports development of all Java application types (Java SE including JavaFX, (Java ME, web, EJB andmobile applications) out of the box. Among other features are an Ant-based project system, Maven support, refactorings, version control (supporting CVS, Subversion, Mercurial and Clearcase).

Modularity: All the functions of the IDE are provided by modules. Each module provides a well defined function, such as support for the Java language, editing, or support for the CVS versioning system, and SVN. NetBeans contains all the modules needed for Java development in a single download, allowing the user to start working immediately. Modules also allow NetBeans to be extended. New features, such as support for other programming languages, can be added by installing additional modules. For instance, Sun Studio, Sun Java Studio Enterprise, and Sun Java Studio Creatorfrom Sun Microsystems are all based on the NetBeans IDE.

License:

From July 2006 through 2007, NetBeans IDE was licensed under Sun’s Common Development and Distribution License (CDDL), a license based on the Mozilla Public License (MPL). In October 2007, Sun announced that NetBeans would henceforth be offered under a dual license of the CDDL and the GPL version 2 licenses, with the GPL linking exception for GNU Classpath.


Categories:

September 2010
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930  

My Blog Stats

  • 5,999 hits