站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Netbeans 专题NetBeans IDE Guide for JBuilder Users

NetBeans IDE Guide for JBuilder Users

摘要: If you have used JBuilder to develop Java applications in the past but are looking to move to NetBeans IDE, you can easily get started. Here is a general guide to the things you need to do to start NetBeans IDE, import your JBuilder projects into NetBeans IDE, and continue work on your projects

Downloading NetBeans IDE

Download NetBeans IDE from http://www.netbeans.info/downloads/index.php.

Once you have downloaded NetBeans IDE, you can start work on importing existing projects from the JBuilder environment into NetBeans IDE.

A Note on the NetBeans IDE Project System

All NetBeans IDE projects are all based around the Ant build tool, which makes NetBeans projects easily portable to other environments. However, you do not necessarily need to know anything about Ant to use NetBeans IDE. When you create standard IDE projects, you can handle all project configuration through the IDE's user interface. The IDE maintains the Ant script for you.

Conceptually, there are two types of projects:

Importing and Running General Java Projects

To import a general Java application into NetBeans IDE, follow these general steps:

Downloading the JBuilder Project Importer Module

You can download the JBuilder Project Importer Module to import projects that you have developed with JBuilder 2005 into NetBeans IDE. (For NetBeans IDE 5.5, this module can also import projects developed with JBuilder 2006). This module eliminates or greatly reduces the amount of work you have to do get your projects working in NetBeans IDE as they worked in JBuilder.

To download the JBuilder Project Importer module:

  1. Start NetBeans IDE.
  2. In NetBeans IDE, choose Tools | Update Center.
  3. In the Update Center wizard, select the JBuilder Project Importer module and complete the wizard.

Importing the JBuilder Java SE Project Into NetBeans IDE

Once you have the importer module added, you can import Java SE projects from JBuilder with a simple wizard.

To import a general Java project into NetBeans IDE:

  1. In NetBeans IDE, choose File | Import Project | JBuilder Java Project.
  2. In the wizard, specify the JBuilder project file (Project to Import field) and the folder where you want the NetBeans IDE project metadata to be created (Destination Folder field).

    In the NetBeans IDE 5.5 version of the project importer, you also are presented with JBuilder User Home and JBuilder Installation Folder. Filling in these fields (where appropriate) makes it easier for the IDE to handle any dependencies that the project has on other projects or libraries.

    The IDE leaves the project sources where they are so that you can still work with them in JBuilder.

Building and Running Your Application

To build your application, right-click the project's node in in the Projects window and choose Build Project.

To run your application in the IDE, right-click the project's node in in the Projects window and choose Run Project.

Note:When you build and run applications in NetBeans IDE, the output also includes output from the Ant script that the project is based on. If you are not specifically concerned with the working of the Ant script, you can ignore that part of the output.

For more information on importing projects into NetBeans IDE 5.0, see http://www.netbeans.org/kb/50/import_j2se.html

Importing Web Projects and Enterprise Projects

NetBeans IDE does not have a special feature to convert JBuilder web and enterprise projects into projects in NetBeans IDE. However, importing existing projects into NetBeans IDE is fairly straightforward.

To import a web or enterprise application project, follow these general steps:

Registering the Server with the IDE

Before setting up a project in the IDE, make sure that the server that you want to develop for is registered in the IDE. Otherwise you will not be able to complete project setup.

The bundled Tomcat Web Server is registered with the IDE automatically. If you installed the NetBeans IDE 5.0/Sun Java System Application Server bundle, a local instance of the application server is registered automatically. If you want to deploy to an instance of an unbundled application server, such as the Sun Java System Application Server, JBoss, or WebLogic, you have to register a local instance with the IDE.

To register an application server instance with the IDE:

  1. Choose Tools > Server Manager from the main window.
  2. Click Add Server. Select the server type and give a name to the instance. Then click Next.
  3. Specify the server information, the location of the local instance of the application server, and the domain to which you want to deploy.

Setting up a NetBeans IDE Project for a Web or Enterprise Application

You can use either of the following techniques for setting up your project in NetBeans IDE:

  • Create a new NetBeans IDE standard project using the sources from the JBuilder project.
  • Use the Export to Ant wizard in JBuilder and then create a NetBeans IDE free-form project using that build script.

When converting JBuilder projects to NetBeans IDE, the way you convert the projects depends largely on these questions:

  • How complex is the project in terms of dependencies, server configuration, database access, and so on?
  • What technologies does the project use?
  • To what extent does the project need to be maintained? Is it likely that the project will need major reworking or extenstion?
  • To what extent do you use the IDE for building tasks and to what extent do you rely on command-line tools or other tools?

If you have a project that you have just started developing or which has not yet become too complex, you will probably want to convert the project into a standard NetBeans IDE project using a "With Existing Sources" template. Doing so gives you full integration with all of NetBeans IDE's features.

If you have a project that is very complex and/or which you do not anticipate extensively modifying, you might find that it is most practical to use a NetBeans IDE free-form project (using a "With Existing Ant Script" template). Creating a free-form project enables you to easily build and modify the project based on an Ant script exported from JBuilder. The IDE uses the Ant script you designate to handle standard project commands, such as building and running the project.

The advantage of this approach is that you do not have to reconfigure your project from scratch. However, if you want full IDE integration using this approach, you might need to some manual configuration to make some features work (such as debugging, code completion, and some other editing feataures). See Advanced Free-Form Project Configuration Guide

Importing a project as a standard NetBeans project

To import a web or enterprise project into NetBeans IDE as a standard project:

  1. In NetBeans IDE, choose File | New Project.
  2. Select the appropriate category (Web or Enterprise).
  3. Select the appropriate template and click next. The possible templates are Web Application With Existing Sources, EJB Module With Existing Sources, and Enterprise Application With Existing Sources.
  4. Complete the wizard.

Importing a project as a free-form NetBeans project

To import a web or enterprise project into NetBeans IDE as a free-form project:

  1. In JBuilder, select the project's node in the Project window.
  2. Choose File | New.
  3. In the Object Gallery, click Build. Then select Export to Ant and click OK.
  4. Complete the Export to Ant wizard.
  5. In NetBeans IDE, choose File | New Project.
  6. Select the appropriate category (Web or Enterprise).
  7. Select the appropriate template and click next. The possible templates are Web Application With Existing Ant Script and EJB Module With Existing Ant Script. There is no free-form project template for Enterprise Application (EAR) projects.
  8. On the Name and Location page of the wizard, specify the location of the build script that you have just exported and complete the other fields on the page.
  9. Complete the rest of the wizard.

Configuring the Project in NetBeans IDE

After creating the NetBeans IDE project, you might need to use the Project Properties dialog box to configure the way the project is built and run.

You can access the Project Properties dialog box by right-clicking the project's main node in the Project window and choosing Properties.

Building and Running Your Application

To build your application, right-click the project's node in in the Projects window and choose Build Project.

To run your application in the IDE, right-click the project's node in in the Projects window and choose Run Project.

Note: When you build and run applications in NetBeans IDE, the output also includes output from the Ant script that the project is based on. If you are not specifically concerned with the working of the Ant script, you can ignore that part of the output.

For more general information on importing web projects into NetBeans IDE 5.0, see http://www.netbeans.org/kb/50/import_web.html

For more general information on importing enterprise projects into NetBeans IDE 5.0, see http://www.netbeans.org/kb/50/import_j2ee.html

Reopening Projects in NetBeans IDE

Projects in the IDE are represented by a folder rather than a file. If you close a project, you can open it again by choosing the File | Open Project command and navigating to the folder containing the project's build script. Project folders are marked with the icon.

Frequently Asked Questions

Where is the NetBeans IDE project file?
NetBeans IDE does not have a single project file. Instead there is a project folder (called nbproject) that contains various pieces of project metadata.

Can I visually edit my JBuilder Swing forms in NetBeans IDE?
Unfortunately, no. However, you might find it worthwhile to use the Matisse GUI Builder within NetBeans IDE to recreate syour legacy forms. Matisse provides makes use of the new GroupLayout layout manager and slick WYSIWIG features to take GUI design to a whole new level of simplicity.

Next Steps

For more detailed information on using NetBeans IDE 5.0, you can investigate the following links:

Using NetBeans IDE 5.0. A medium-sized guide to NetBeans IDE's features.

NetBeans 5.0 Tutorials, Guides, and Articles page. Lists the main tutorials and guides for NetBeans IDE 5.0 and provides links to others.

NetBeans IDE FAQs. A comprehensive list frequently asked questions and their answers.

nbusers mailing list. An active mailing list of NetBeans IDE users. You can search the archives or join the list and ask your own questions.


↑返回目录
前一篇: NetBeans IDE GUI 生成器可视反馈说明
后一篇: NetBeans Mobility Pack 5.0 Quick Start Guide