What's New in NetBeans IDE 4.0
NetBeans IDE 4.0 is a major feature release. The features listed below are introduced
in 4.0 since the previous release (3.6). The product has been completely overhauled to
allow you to develop and maintain your applications more
productively and efficiently than ever before. If you are a returning user, you will notice significant
enhancements in each area of your development cycle:
For detailed information about transitioning to NetBeans IDE 4.0, see the
Transitioning from NetBeans IDE 3.6 to 4.0 Beta Guide.
Managing Source Code and Libraries
Projects have been completely redesigned in NetBeans IDE 4.0. Now, all application development takes place within a project.
A project is a group of source files together with the settings that you define to build, run, and debug them.
You can split applications that involve large code bases into several projects and
create compilation dependencies between them. Then, when you build one of the projects, all the other projects on the
compilation classpath are built as well. You can share projects using the built-in support for the version control systems
CVS, VSS, and PVCS.
Multiple projects can be open at the same time so that you can quickly and easily switch from one to another
and work on many projects simultaneously. When you open a project, you can view its logical structure in the
Projects window and its file structure
in the Files window. Menus and toolbar buttons are provided so that you can perform one-click actions such as
the following on a project:
- Attach Debugger
In addition, you can perform these actions on single files too.
|Project templates and wizards
NetBeans IDE 4.0 includes project templates and wizards designed to support different types of project development.
For example, it contains a wizard to define a Java application project based on
a Java application project template.
NetBeans IDE 4.0 comes with the following templates for creating projects from scratch:
Application. Template for creating a skeleton J2SE project with a main class.
Class Library. Template for creating a skeleton Java class library without a main class.
Application. Template for creating a skeleton web application.
For more information about creating projects from scratch, see the
Quick Start Guide
and the Quick Start Guide for Web Applications.
NetBeans IDE 4.0 comes with the following templates for creating projects for your existing source files:
When you use NetBeans IDE 4.0 to browse the folders in your system, folders that are valid projects are flagged with the icon.
For more information about importing and using your own source files, see the
Importing Existing Java Source Code Guide
and the Importing Existing Web Applications Guide.
|Support for the Java™ 2 Micro Edition (J2ME™) MIDP 2.0 and CLDC 1.1 standards
J2ME MIDP 2.0/CLDC 1.1 standard support in NetBeans IDE 4.0 lets you write, test, and debug applications for Java technology-enabled
mobile devices. NetBeans IDE 4.0 simplifies coding of these applications by providing templates for MIDlet and MIDlet suites and code
completion in the Source Editor for J2ME packages. In addition, you can integrate third-party emulators and create device
configurations for a robust testing environment.
NetBeans IDE 4.0 support for the J2ME MIDP 2.0/CLDC 1.1 standards includes the following:
- Integration with the J2ME Wireless Toolkit 2.2
- Integration with other third-party emulator platforms
- Integration of obfuscation and optimization support
- Support for MIDP localization by enabling the integration of locale-specific components
- Resolution of device fragmentation by enabling code development for device configurations
- Over-the-Air (OTA) download testing
- Several J2ME MIDP sample projects
For information on creating or importing J2ME MIDP applications, see the
Quick Start Guide
and the Importing Existing J2ME MIDP Source Code Guide.
|Tag library templates and wizards
NetBeans IDE 4.0 includes enhancements that simplify the creation of tag libraries.
You use wizards that are new in NetBeans IDE 4.0 to create tag handlers,
tag files, and tag library descriptors. Then, you develop tags either in the Java programming language
or in the syntax for the JavaServer Pages technology, or both.
NetBeans IDE 4.0 comes with the following tag library templates:
- Tag library descriptor.
Template for creating a tag library descriptor in JSP2.0 syntax (for J2EE1.4 projects) or in JSP1.2 syntax (for J2EE1.3 projects).
- Tag file.
Template for creating a tag file with sample code in either JSP or XML syntax.
- Tag handler.
Template for creating a BodyTag handler or SimpleTag handler (JSP2.0) with sample Java source code.
For more information about creating and using tag libraries, see the
Tag Library Tutorial.
NetBeans IDE 4.0 is bundled with several tools that enhance development, code
completion, and compilation needs:
- Apache Ant
- Tomcat Server
- API classes and documentation for the Servlet and JSP APIs
- JavaServer Pages Standard Tag Library (JSTL)
Apache Ant and Tomcat Server require no special set up and
can be used straight out-of-the-box. When you create a new project,
libraries appropriate to the project's type will automatically be
included in the project's classpath. Additionally, you can manually
include a library in a project's classpath.
J2SE 5.0 aims to ease development and improve the
scalability, performance, monitoring and manageability of your applications.
It is fully supported by NetBeans IDE 4.0. For example, you can use new J2SE 5.0
such as enums, generics and metadata annotations
to build and edit your applications.
Features such as error annotations (error underlying) and
code folding can be used with J2SE 5.0 sources and the Source Editor supports
code completion and syntax highlighting of J2SE 5.0 language keywords.
For information about J2SE 5.0, see
New Features and Enhancements J2SE 5.0.
Refactoring functionality has been integrated into the Source Editor. As a result,
you can make sweeping modifications to pieces of code without affecting their functionality.
You can use refactoring to do the following in NetBeans IDE 4.0:
- Rename packages, classes, methods, and fields
- Move classes from package to package
- Encapsulate fields generates 'get' and 'set' methods and replaces the usage of
the original fields with these methods
- Change method parameters
- Find references, declarations, and usages of classes and their members
Note that the Generate R/W Property
command has been removed, since the Encapsulate Fields command includes the same functionality.
Code completion and syntax highlighting have been enhanced to include
Customizers are no longer supported for tag library descriptors and tag handlers, because you can now use
code completion in the Source Editor to edit their attributes, properties, and behavior.
- Tag library descriptors conforming to the JSP2.0 or JSP1.2 specification
- Tag files in JSP syntax
You manage external references in a Java source file by right-clicking in the Source Editor
and choosing Fix Imports from the contextual menu.
Import statements that are needed by your code are added, unused import statements are removed,
and unresolved identifiers are fixed. This menu item replaces the Import Management Tool.
Editing flexibility in NetBeans IDE 4.0 has been enhanced as follows:
- Sliding auto-hide windows.
- Multiple views per form object. You can easily switch
between different views of a single form object. As a result,
there is no need to open a new window per view because
you can see both the source view and the form view within the same tab of
the Form Editor.
- Visual alignment with Aqua LookAndFeel on MacOS X.
Building, Running, and Debugging
Apache Ant is the leading Java-based build tool used to standardize and automate
build and run environments for development. NetBeans IDE 4.0 builds its project infrastructure
directly on top of Ant. It stores all of the information
about your project in an Ant script, a properties file, and a few XML configuration files.
This means that you can build and run your projects outside of the IDE exactly the
same as inside the IDE.
You don't need to perform any special setup activities, because NetBeans
IDE 4.0 provides the following straight out-of-the-box:
- Apache Ant as a build engine
- Project metadata as Ant build scripts
- Ability to build applications outside of the IDE using Ant
- Fully integrated support for unit testing (JUnit) of Java applications
Beginning users don't have to know Ant to use the system, but the full
power of Ant is accessible to advanced Ant users. These users can customize
a project's build script or use their own to build a project.
For more information about writing and customizing Ant build scripts, see the
Advanced Free-Form Project Configuration Guide.
As in NetBeans IDE 3.5, you can compile JSP files. In NetBeans IDE 3.6, you could only
validate JSP files. The Validate action prevented you from being able to translate the JSP code into a servlet.
Therefore, the Validate action did not discover syntax errors that occur at translation time or runtime.
This is now possible again.
Projects in NetBeans IDE 4.0 come with built-in support
for generating, developing and running unit tests using JUnit,
the de facto standard in Java code testing. You can
maintain a separate classpath for building
and running JUnit tests, regardless of whether you set it in your own Ant build script
or in NetBeans IDE 4.0.