Home > Store

NetBeans  IDE Field Guide: Developing Desktop, Web, Enterprise, and Mobile Applications

Register your product to gain access to bonus material or receive a coupon.

NetBeans IDE Field Guide: Developing Desktop, Web, Enterprise, and Mobile Applications

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2005
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-187620-1
  • ISBN-13: 978-0-13-187620-0

The Only Complete Guide and Reference for NetBeans IDE 4.1!

The award-winning NetBeans integrated development environment is today's state-of-the-art Java IDE. NetBeans is the first free, open source IDE to support Java 2 Standard Edition (J2SE) 5.0, and it's a leader in providing advanced support for Java 2 Enterprise Edition (J2EE), Java 2 Micro Edition (J2ME), and other technologies. NetBeans IDE eases all aspects of Java application development, incorporating a wide range of powerful features into one well-designed package.

NetBeans™ IDE Field Guide is a comprehensive introductory guide and task reference--it's the fast-answers NetBeans "cookbook" for every Java developer. The authors show you how to use NetBeans to build applications for the desktop, web, enterprise, and handset. Coverage includes

  • Navigating NetBeans IDE, and creating, opening, and configuring projects
  • Using NetBeans' special Ant integration to work with complex existing projects
  • Maximizing productivity in everyday coding, debugging, and refactoring
  • Developing web applications with NetBeans' built-in Apache Tomcat Web server
  • Creating and consuming web services
  • Using enterprise beans to extend web applications with business logic
  • Constructing, assembling, and verifying large-scale J2EE applications
  • Managing the Sun Java System Application Server through NetBeans IDE
  • Developing J2ME handheld applications with the NetBeans Mobility Pack

If you're new to NetBeans, this book will help you quickly leverage its power throughout the entire edit-compile-test-debug-deploy cycle. If you've worked with older versions, you'll learn how to make the most of its dramatic improvements. Whatever you're building with Java, NetBeans™ IDE Field Guide will help you build it faster, better, and more efficiently.



Extras

Author's Site

Untitled Document Visit the Author's Site related to this title.

Sample Content

Online Sample Chapter

Debugging Java Applications

Downloadable Sample Chapter

Untitled Document Download the Sample Chapter related to this title.

Table of Contents

Foreword by James Gosling.

Foreword by Bill Shannon.

Preface.

About the Authors.

Acknowledgments.

1. Download, Installation, and First Project.

    Downloading the IDE

    Installing the IDE

    Setting a Proxy

    First NetBeans IDE Project

2. NetBeans IDE Fundamentals.

    Creating a Project

    Configuring the Classpath

    Creating a Subproject

    Creating and Editing Files

    Setting Up and Modifying Java Packages

    Compiling and Building

    Viewing Project Metadata and Build Results

    Navigating to the Source of Compilation Errors

    Running

    Creating and Running Tests

    Debugging the Application

    Integrating Version Control Commands

    Managing IDE Windows

3. IDE Project Fundamentals.

    Introduction to IDE Projects

    Choosing the Right Project Template

    Creating a Project from Scratch

    Importing a Project Developed in a Different Environment

    Navigating Your Projects

    Working with Files Not in the Project

    Creating Packages and Files in the Project

    Configuring the Project's Classpath

    Changing the Version of the JDK That Your Project Is Based On

    Changing the Target JDK for a Standard Project

    Referencing JDK Documentation (Javadoc) from the Project

    Adding Folders and JAR Files to the Classpath

    Making External Sources and Javadoc Available in the IDE

    Structuring Your Projects

    Displaying and Hiding Projects

    Setting Up a Project to Work with Version Control

    Compiling a Project

    Running a Project

    Writing Your Own Manifest for Your JAR File

    Filtering Contents Packaged into Outputs

    Running a Project from Outside of the IDE

    Customizing the IDE-Generated Build Script

    Running a Specific Ant Target from the IDE

    Completing Ant Expressions

    Making a Menu Item or Shortcut for a Specific Ant Target

4. Editing and Refactoring Code.

    Opening the Source Editor

    Managing Automatic Insertion of Closing Characters

    Displaying Line Numbers

    Generating Code Snippets

    Handling Imports

    Displaying Javadoc Documentation While Editing

    Formatting Code

    Navigating within the Current Java File

    Navigating from the Source Editor

    Searching and Replacing

    Moving a Class to a Different Package

    Changing a Method's Signature

    Tracking Notes to Yourself in Your Code

    Comparing Differences Between Two Files

    Splitting the Source Editor

    Maximizing Space for the Source Editor

    Changing Source Editor Keyboard Shortcuts

    Building Rich Clients

5. Debugging Java Applications.

    Starting a Debugging Session

    Attaching the Debugger to a Running Application

    Starting the Debugger Outside of the Project's Main Class

    Stepping Through Code

    Setting Breakpoints

    Managing Breakpoints

    Customizing Breakpoint Behavior

    Monitoring Variables and Expressions

    Backing Up from a Method to Its Call

    Monitoring and Controlling Execution of Threads

    Fixing Code During a Debugging Session

    Viewing Multiple Debugger Windows Simultaneously

6. Developing Web Applications.

    Representation of Web Applications in the IDE

    Adding Files and Libraries to Your Web Application

    Editing and Refactoring Web Application Files

    Deploying a Web Application

    Testing and Debugging Your Web Application

    Creating and Deploying Applets

    Changing the IDE's Default Web Browser

    Monitoring HTTP Transactions

7. Introduction to J2EE Development in NetBeans IDE.

    Configuring the IDE for J2EE Development

    Getting the Most from the Java BluePrints Solutions Catalog

8. Extending Web Applications with Business Logic: Introducing Enterprise Beans.

    EJB Project Type Wizards

    Adding Enterprise Beans, Files, and Libraries to Your EJB Module

    Adding Business Logic to an Enterprise Bean

    Adding a Simple Business Method

    Enterprise Bean Deployment Descriptors

9. Extending J2EE Applications with Web Services.

    Consuming Existing Web Services

    Implementing a Web Service in a Web Application

    Implementing Web Services within an EJB Module

    Testing Web Services

    Adding Message Handlers to a Web Service

10. Developing Full-Scale J2EE Applications.

    Creating Entity Beans with the Top-Down Approach

    Creating Entity Beans with the Bottom-Up Approach

    Assembling J2EE Applications

    Importing Existing J2EE Applications

    Consuming J2EE Resources

    J2EE and Security Management

    Understanding the J2EE Application Server Runtime Environment

    Ensuring J2EE Compliance

    Refactoring Enterprise Beans

11. Developing J2ME Mobility Applications.

    Downloading and Installing the Mobility Pack

    Setting Up Mobility Projects

    Creating a Project from Scratch

    Importing a Project

    Physical Structure of Mobile Projects

    Using Mobility File Templates

    Configuring the Project's Classpath

    Debugging Your Project

    Configuring Your Project for Different Devices

    Setting the Active Configuration for Your Project

    Reusing Project Settings and Configurations

    Structuring Project Dependencies

    Managing the Distribution JAR File Content

    Handling Project Resources for Different Configurations

    Writing Code Specific to a List of Configurations

    Using Configuration Abilities

    Creating and Associating an Ability with a Configuration

    Localizing Applications

    Using the MIDP Visual Designer

    Deploying Your Application Automatically

    Incrementing the Application's MIDlet-Version Automatically

    Installing Nonstandard Emulator Platforms

    Using Ant in Mobility Projects

    Using Headless Builds

    Finding More Information

12. Integrating Existing Ant Scripts with the IDE.

    Creating a Free-Form Project

    Mapping a Target to an IDE Command

    Setting Up the Debug Project Command for a General Java Application

    Setting Up the Debug Project Command for a Web Application

    Setting Up Commands for Selected Files

    Setting Up the Compile File Command

    Setting Up the Run File Command

    Setting Up the Debug File Command

    Setting Up the Debugger's Apply Code Changes Command

    Changing the Target JDK for a Free-Form Project

    Making a Custom Menu Item for a Target

    Debugging Ant Scripts

Appendix: Importing an Eclipse Project into NetBeans IDE.

    Getting the Eclipse Project Importer

    Choosing Between Importing with and Importing without Project Dependencies

    Importing an Eclipse Project and Preserving Project Dependencies

    Importing an Eclipse Project and Ignoring Project Dependencies

    Handling Eclipse Project Discrepancies

    Handling Eclipse Project Reference Problems

Index.

Preface

Untitled Document

This book is designed both as an introduction to NetBeans IDE and as a task reference, something that you can pick up from time to time to get an answer to a question or to find new ways to take advantage of the IDE's possibilities. Whether NetBeans is your first IDE or your fifth, this book can help you make the most of the IDE.

What Is NetBeans IDE?

NetBeans IDE is a free-of-charge integrated development environment (IDE) primarily focused on making it easier to develop Java applications. It provides support for all types of Java applications, from rich desktop clients to multitier enterprise applications to applications for Java-enabled handheld devices.

NetBeans IDE has a modular architecture that allows for plug-ins. However, the range of features in the basic installation is so rich that you can probably can start using the IDE for your work without worrying about plug-ins at all.

The IDE itself is written in Java, so you can run it on any operating system for which there is a Java 2 Standard Edition JDK (Version 1.4.2, Version 5.0, or later) available. Click-through installers are generally available for Microsoft Windows, Solaris, Linux, Mac OS, and OpenVMS systems. You can also download the IDE as a .zip or .tar file if you want to install it on an operating system other than the ones listed above.

The IDE's basic job is to make the edit-compile-debug cycle much smoother by integrating the tools for these activities. For example, the IDE:

  • Identifies coding errors almost immediately and marks them in the Source Editor.
  • Helps you code faster with code completion, word matching, abbreviation expansion, and fix import features.
  • Provides visual navigation aids, such as the Navigator window and "'code folding,"' as well as numerous keyboard navigation shortcuts designed especially for Java programmers.
  • Can display documentation for a class as you are typing in the Source Editor.
  • Hot-links compilation errors in the Output window, so you can jump straight to the source by double-clicking the line or pressing F12.
  • Manages package names and references to other classes. When you rename or move classes around, the IDE identifies places in the code that are affected by these changes and enables you to have the IDE generate the appropriate changes to those files.
  • Has many debugging features that provide a comprehensive view of the way your code is working as it runs. You can set breakpoints, which persist from session to session and keep your code free of clutter, such as println statements.
  • Helps you integrate other parts of your workflow, such as checking sources into and out from a version control system.

You can also download the NetBeans Profiler to augment the traditional edit-compile-debug cycle with performance testing.What Makes NetBeans IDE SpecialWhen you use NetBeans IDE, you get the benefits of a top-shelf IDE without the negatives that you might associate with moving your development to a single environment.

Like other integrated development environments, NetBeans IDE provides a graphical user interface for command line tools that handle the compiling, debugging, and packaging of applications.

Unlike other IDEs, NetBeans IDE does not force a build structure on you with project metadata that you need to reverse engineer if you are to use build the project outside of the IDE. NetBeans IDE builds on existing open standards to help you automate your development process without locking you in.

NetBeans IDE bases its whole project system on Ant, which is the de facto standard build tool for Java applications. The project metadata that NetBeans IDE produces is in the form of XML and properties files that can be used by Ant outside of the IDE. Thus developing a project in NetBeans IDE does not lock you or co-developers into NetBeans IDE.

You can use NetBeans IDE to create large projects with sophisticated build parameters. Where you already have such projects in place, you can adapt NetBeans IDE to work with them without necessarily changing the project's structure. If you are generally more comfortable with command line tools because of their transparency and the level of control they allow you over your projects, NetBeans IDE could become the first IDE that you love.

NetBeans IDE is also consistently ahead of the curve in providing support for new and evolving standards, such as the new language features that were introduced in the J2SE 5 JDK and new specifications in all areas of Java technology.

NetBeans IDE provides an astonishing array of features right out of the box. NetBeans has a fully featured J2EE development environment built in. All the editor, debugger and project support that is available for Java application development is also available for J2EE development. In addition, NetBeans IDE provides access to the Java BluePrints Solutions Catalog and the ability to install them as NetBeans projects.

The Mobility Pack, available as a free download, enables J2ME developer's to design, develop and debug J2ME MIDlets from within NetBeans IDE. Providing one of the most powerful sets of mobile development tools, the Mobility Pack includes a flow designer to visually layout the application logic, a screen designer to create the user interface, an integrated device fragmentation solution, and tools for building client server applications.

What Comes with NetBeans IDE

Besides providing support for coding, NetBeans IDE comes bundled with other tools and libraries that you might already use in your production environment. The IDE integrates these tools into the IDE workflow, but you can also use them at the command line.

Out of the box with NetBeans IDE 4.1, you get:

  • Apache Ant 1.6.2
  • Tomcat 5.5.7
  • JUnit 3.8.1
  • Java BluePrints Solutions Catalog

If you download the Mobility Modules pack, you also get the Wireless Toolkit.You can also get NetBeans IDE in a bundle with the J2SE JDK or the Sun Java System Application Server Platform Edition.

If you download the NetBeans Profiler, you also get a full-featured, nonintrusive Java profiler that is based on the JFluid profiling technology.

What This Book Will Do for You

This book was written with both new and existing NetBeans IDE users in mind.If you are new to NetBeans IDE (or IDEs in general), this book will quickly guide you through the basics and advantages of using NetBeans IDE. Learn how to take advantage of the IDE's layout and feature integration to tighten up the basic edit-compile-debug cycle. Learn how to take advantage of the IDE's support for increasingly popular advanced technologies such as Web services and J2EE technology to add new capabilities to your applications.

If you are already familiar with NetBeans IDE, this book will provide a new perspective on what you already know and possibly point you to useful features that you have not yet discovered. Learn how you can customize the IDE to work with complex build structures. If you are looking to move from client-server Web applications to multitier transactional enterprise applications, this book will help you make that jump.

This book does not teach the Java programming language. Much of the material in this book is meaningful only if you have some experience with programming Java applications. However, this book could be a useful companion if you are expanding your Java technology palette into J2EE technology and other advanced areas.

How to Use This Book

There is a lot to write about NetBeans IDE, which is overflowing with features. NetBeans IDE Field Guide sorts out the essentials so that you can get productive quickly and then adds a generous selection of tips and advanced information.This book is primarily designed as a task-reference with short topics on accomplishing specific tasks. If you wish, you can read the book from cover to cover, but most likely you will want to keep it near your computer to ask pressing questions or simply to read up on ways to get more out of your work with the IDE. The topics are written in a way that allows you to skip all over the book to get answers to the specific questions you have without having to follow long end-to-end examples.

Chapter 1 provides the information you need to get NetBeans IDE and to open your first project.

Chapter 2 provides an overview of the IDE environment and the basic tasks for developing general Java projects. If you have never used NetBeans IDE, you will probably want to read this chapter from end to end.

Chapter 3 provides in-depth information on setting up and configuring projects. Though this chapter is mostly geared toward general Java applications, a working knowledge of the information in this chapter will be useful for developing J2EE and J2ME applications as well.

Chapter 4 (editing) and Chapter 5 (debugging) provide useful tips and tricks for making your day-to-day coding and troubleshooting more productive.

Chapter 6 covers development of Web applications, with a focus on developing with the Tomcat Web server.

Several chapters are devoted to J2EE topics. You should begin with Chapter 7, Introduction to J2EE Development in NetBeans IDE, to get information on setting up your environment and learning how to leverage the Java BluePrints Solutions catalog in J2EE development.

If you are familiar with Web application development and would like to learn how to extend it into using J2EE Enterprise JavaBeans components, you should read Chapter 8, Extending Web Applications with Business Logic: Introducing Enterprise Beans.

If you are interested in learning how to extend your J2EE applications to include Web services, you should read Chapter 9, Extending J2EE Applications with Web Services.

Chapter 10, Developing Full Scale J2EE Applications, contains in-depth information on developing entity beans, assembling applications, verifying J2EE compliance, and other topics.

Chapter 11 covers special IDE features for using the NetBeans Mobility Pack to develop J2ME applications for handheld devices.

Chapter 12 provides information for taking advantage of NetBeans IDE's unique Ant integration to use the IDE with existing intricate build environments.

NetBeans As Platform and Open-Source Project

Besides being an IDE, NetBeans is also a 100% pure Java open-source platform. You can develop plug-in modules for NetBeans IDE or create an entirely different application built on top of a small core of the modules that make up the IDE. Because NetBeans is 100% pure Java, any platform that supports a Java Virtual Machine will run NetBeans. Hence, any plug-in module or application that extends NetBeans and that is 100% pure Java will also execute on any platform for which there is a Java Virtual Machine. However, you should note that this book covers use of the IDE only to develop Java applications.

See http://www.netbeans.org/community/kb/index.html for information on creating plug-in modules for NetBeans IDE and http://www.netbeans.org/community/kb/platform.html for information on using the platform as an application framework.



Foreword

Untitled Document Download the Foreword related to this title.

Index

Untitled Document Download the Index related to this title.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020