Tips for Migrating Java Studio Enterprise 8.1 Projects to NetBeans IDE 6.0
Contributed by
and
December 2007 [Revision number: V6.0-1]
This publication is applicable to Sun Java Studio Enterprise 8.1 and NetBeans IDE 6.0 releases
The NetBeans IDE 6.0 provides the same UML Modeling, Developer Collaboration, Profiler, and Portlet Builder features that were offered in the Sun Java Studio Enterprise IDE 8.1. This document provides a glimpse of the features to be found in the NetBeans IDE 6.0, and includes a step-by-step guide to help you migrate from Sun Java Studio Enterprise IDE 8.1. This document also walks you through the steps to configure your NetBeans IDE 6.0 environment so that you can import your existing Sun Java Studio Enterprise 8.1 projects into the NetBeans IDE.
NetBeans IDE 6.0 improves your developer productivity through a smarter, faster editor, and the integration of all NetBeans developer tools into a single IDE. A number of familiar features from Java Studio Enterprise IDE 8.1 have been updated, like Java SE and EE programming, profiling, portlet building, UML support, and developer collaboration. NetBeans IDE 6.0 also includes the following new features introduced since the Java Studio Enterprise 8.1 release:
Ruby, JRuby, and Ruby on Rails support
Highly acclaimed Swing GUI Builder
Visual Web development through the Visual Web Pack
Java Mobility (Java ME) support through the Mobility Pack
Service Oriented Architecture (SOA) support through the Enterprise Pack
C or C++ development through the C/C++ Pack
Generic Language Framework
The NetBeans IDE 6.0 provides developers with all the tools they need to create professional cross-platform desktop, enterprise, web and mobile applications. See the NetBeans IDE 6.0 Description for full details.
Before You Begin
Consider the following items when migrating your projects from Sun Java Studio Enterprise 8.1 (hereinafter also referred to as Java Studio IDE) projects into NetBeans IDE 6.0 (hereinafter also referred to as NetBeans IDE).
Always copy project folders before opening projects in NetBeans IDE 6.0.
Installing the NetBeans IDE 6.0 and Feature Plugins
The following table lists the Sun Java Studio Enterprise 8.1 features, their corresponding NetBeans IDE 6.0 features, and information about where the appropriate NetBeans plugins are available for download.
Java Studio Enterprise
8.1 Key Features
Corresponding NetBeans
IDE 6.0 Features
NetBeans IDE 6.0 Plugins
Download Information
UML Modeling
NetBeans UML
Available from the NetBeans Update Center (more info)
Application Profiling
NetBeans Profiler
Included with the Java EE 5 Tools Bundle Update 3 release
Developer Collaboration
NetBeans Developer Collaboration
Available through NetBeans Update Center (more info)
Portlet Builder
NetBeans Portal Pack
Portlet Container 2.0
Included with the Java EE 5 Tools Bundle Update 3 release
Included with the Java EE 5 Tools Bundle Update 3 release
Before you continue with this document, install the Java Platform, Enterprise Edition 5 (Java EE 5) Tools Update Bundle. It includes the following components that you need to migrate your Java Studio Enterprise 8.1 projects to NetBeans IDE 6.0.
NetBeans IDE 6.0 (includes NetBeans Profiler feature)
NetBeans Portal Pack 2.0
Sun Java System Application Server 9.1
Portlet Container 2.0
Use the following steps to download and install the Java EE 5 Tools Bundle Update 3:
From the Java EE 5 SDK Update Downloads tab , click Download with Tools, as shown in the following image.
Note that you may be prompted to log in with your Sun Online Account to proceed with the download.
Figure 1: Java EE Bundle Download Page
Review and accept the license agreement.
Make the appropriate download selection for your platform and click Download Selected with Sun Download Manager.
After the installer is downloaded successfully, run the installer by invokling the file you just downloaded.
Click Next in the Welcome screen.
Specify the folder in which to install the NetBeans IDE and click Next.
Specify the folder to use for the Application Server installation and accept the default server properties or make the necessary changes.
Click Install if the Summary information is correct.
Start NetBeans IDE 6.0.
After you have the Java EE 5 Tools Update Bundle installed, you can also install the NetBeans UML and the NetBeans Developer Collaboration plugins by using the steps in the Downloading Plugins section. You need both plugins to work with UML and Developer Collaboration sections of this guide.
After a successful installation of the NetBeans IDE and any of the additional plugins listed previously, use the NetBeans IDE 6.0 Quick Start Guide to help you become familiar with the NetBeans IDE 6.0. Beware of some graphical user interface differences between the Java Studio Enterprise IDE and NetBeans IDE. For more information about working with the NetBeans IDE, you can also refer to the Support and Docs page on the NetBeans web site or the online help in the IDE.
Downloading Plugins Through the NetBeans Update Center
Use the following steps to download the UML Modeling and the Developer Collaboration plugins from the NetBeans Update Center.
Start the NetBeans IDE 6.0, if it's not already started.
From the main menu of the NetBeans IDE, choose Tools > Plugins.
In the Plugins dialog, click the Settings tab.
Ensure that all the listed Update Centers are marked as Active.
Figure 2: Settings Tab in Plugins Dialog
The Updates and Available Plugins tabs are updated with the number of plugins available from the Update Centers.
Click the Available Plugins tab.
Locate the UML plugin and check its corresponding Install checkbox.
You can use the Search text field to assist you in locating the plugin. Type uml in the Search text field to locate the UML plugin in the list, as shown in the following image:
Figure 3: Available Plugins Tab in Plugins Dialog
Click Install.
In the NetBeans IDE Installer dialog, choose one of the following:
Click Next to review and accept any license agreement that appears for the plugin. Then, click Install.
If the plugin does not have any license agreement, click Install to proceed with the plugin installation.
After the UML plugin is installed successfully, click Finish to dismiss the NetBeans IDE Installer dialog.
If necessary, follow the previous steps 5-8 to install the Developer Collaboration plugin.
After all the necessary plugins have been installed, click Close to dismiss the Plugins dialog.
This guide assumes that you deployed your Java Studio applications by using the Sun Application Server 8.2, which was included in the Java Studio IDE. You can deploy those same applications by using the Sun Application Server 9.1 that is included with the NetBeans IDE installation. The Sun Application Server 8.2 is not included in the default installation of the NetBeans IDE release. If you choose to continue deploying your Java Studio applications by using your Sun Application Server 8.2 installation, use the following steps to add an instance of the server to your NetBeans 6.0 IDE. It is assumed that you still have the Sun Application Server 8.2 server installed on your system.
Click the Services tab and expand the Servers node.
If you do not see the Sun Java Application Server node displayed, right-click the Servers node.
Click Add Server.
In the Add Server Instance dialog, choose Sun Java System Application Server and click Next.
In the Platform Folder Location pane, click Browse and navigate to the installation folder associated with the Sun Java System Application Server 8.2 domain being registered.
Keep the Register Local Default Domain selected and click Next.
In the Domain Admin Login Info page, the Admin Username and Admin Password fields should be filled already. If they are not, use the following default values:
The NetBeans UML plugin can be downloaded and installed through the NetBeans Update Center (more info).
After you have installed the UML plugin, use the following steps to open your existing UML project that you have created by using the Java Studio IDE 8.1.
Select File > Open Project from the main menu of the NetBeans IDE.
In the Open Project dialog, select your UML project and select Open Project.
The project is displayed in the Projects window of the NetBeans IDE.
Expand the UML project node and then the Diagrams node.
Double-click on one of the nodes for the diagrams in your project to display it in the Diagram editor.
Setting Up Your Developer Collaboration Environment
As indicated earlier, the Developer Collaboration plugin is not part of the
NetBeans IDE's installation distribution and must be downloaded from the NetBeans
Update Center (more info). After you have installed the
plugin, use the following steps to add and set up your existing
account on a collaboration server.
Select Collaboration > Login in the main menu of the NetBeans IDE.
In the Collaboration session window, click Add Account.
The Add Collaboration Account dialog appears, as shown in the following image.
Figure 4: Add Collaboration Account Dialog
In the Account Creation pane, select the third option and click Next.
In the Account Name pane, type your account's display name in the Display Name field and click Next.
In the Server Location pane, type the server's host name (on which your collaboration user account is located) in the Server Hostname field.
The default collaboration servers is share.java.net.
In the Connect via Proxy section, select the first option if a proxy is not required or one of the other two options, if a proxy is required.
If you select one of the latter two proxy options, provide in the Proxy Server section the hostname, username, and password values to access the proxy server.
In the Account Details section, type your user name in the User Name field and click Finish.
In the Collaboration Login window, enter the Password.
The Account login name you just created should already be selected.
Click Login.
The Collaboration Sessions window is displayed and you should be able to begin a session.
The full-featured profiling functionality is provided with the NetBeans Profiler plugin, which is included with the NetBeans
IDE 6.0 installation. In this section, you open the Application Profiler demo project, Speed Reader, that was available
with the Java Studio IDE. Use the following steps to
enable the Profiler Collector in the IDE, deploy the Speed Reader Demo and
analyze its performance. You then tune the Speed Reader Demo application, redeploy it, and examine its improved performance.
Select Profile > Advanced Commands > Run Profiler Calibration to run the calibration command for your target JVM before running the Profiler.
In the Select Java Platform to Calibrate window, select the Java Platform to calibrate and click OK.
The Java platform you choose is the one used in the following steps.
Click OK in the Information dialog after a successful callibration.
Download the Java Studio Enterprise's SpeedReaderDemo.zipfile and unzip the file into a local directory.
The SpeedReaderDemo folder has two folders: ProfilerTestLib1 and SpeedReader
In the NetBeans IDE, select File > Open Project.
In the Open Project dialog, navigate to where you extracted the SpeedReaderDemo.zip file.
Select the SpeedReader project and click Open Project.
In the Projects window, the node for the SpeedReader project appears.
Right-click the SpeedReader project node and select Run.
The SpeedReader demo starts in a browser at: http://<localhost:port>/SpeedReader-WebModule/Welcome.jsp. Note that if the application server is not yet started, the IDE automatically starts it for you.
From the main menu of the NetBeans IDE, select Profile > Profile Main Project.
In the Select Java Platform for Profiling dialog, select JDK 1.6 (default) as the platform to use.
You can optionally check the Always Use the Selected Platform for Profiling checkbox.
Click OK.
If this is the first time the SpeedReader project is being profiled, a Question dialog appears asking if you want to continue the modification of the build script to enable profiling.
Figure 5: Profiler Question Dialog
Click OK in the Question dialog.
In the Profile SpeedReader window; select Entire Application and choose Profile Only Project Classes from the drop-down list for the Filter field.
Check the Use Defined Profiling Points box.
Click Run.
The SpeedReader Demo starts in a browser. This is a complete example of profiling and tuning the SpeedReader sample application
To start building portlets in NetBeans IDE 6.0, you need to have the following installed in the IDE:
NetBeans Portal Pack 2.0
GlassFish V2 Application Server (Sun Java System Application Server 9.1)
Portlet Container 2.0
These components are included in the Java EE 5 Bundle pack you installed in Installing the NetBeans IDE 6.0 section. The GlassFish V2 application server is accessible
through the IDE's Services window. It is assumed that you have the GlassFish V2 Application Server already installed before proceeding with the following steps. For more information about using the GlassFish Application Server, visit the GlassFish Quick Start Guide.
Configuring a New Portlet Container Instance in NetBeans IDE 6.0
Use the following steps to configure a new Portlet Container instance in the NetBeans IDE.
Select Tools > Servers from the NetBeans IDE's main menu.
Click Add Server.
In the Add Server Instance dialog, select OpenPortal Portlet Container 2.0 Beta from the list of servers displayed and click Next.
Figure 7: Choose Server Dialog
Select GlassFish / Sun Java System AppServer 9.1 from the drop-down list
In the GlassFish Home field, type the folder in which the GlassFish/Sun Java Application Server 9.1 is installed.
You can click the browse button (...) to navigate to the folder.
The rest of the fields should be automatically filled after specifying the GlassFish Home value.
If necessary, modify the Domain Dir as $GlassFish Home/domains/$domain.
The
default $domain value is domain1. You can click the browse (...) button to select Domain Directory
Type the GlassFish/Sun Java Application Server 9.1 admin password.
The default password is adminadmin.
Figure 8: Add Server Instance Dialog
Click Next.
In the Open Source Portlet Container panel, accept the values in the fields and click Finish.
In the Servers dialog, a new node for the OpenPortal Portlet Container
is added under the Java EE Servers folder node.
Click Close in the Servers dialog and click the Services tab.
Notice that a node for the OpenPortal Portlet Container 2.0 Beta has been added to the Servers node.
Figure 9: OpenPortal Portlet Container 2.0 Node in Servers Window
For more information about the OpenPortal Portlet Container project, visit the OpenPortal project page .
Working With an Existing Portlet Application in the NetBeans IDE 6.0
Now that you have configured an instance of the OpenPortal Portlet Container, you can do the following:
Creating a Portlet Using Your Existing JSE 8.1 Application Sources
In NetBeans IDE 6.0, the Portal Pack enable you to add portlet support to an
existing web application by adding a Portlet Support framework. Use the following steps to create a new NetBeans 6.0 web application project by using one of your existing portlet applications that you built by using the Java Studio Enterprise IDE 8.1.
From the main menu of the NetBeans IDE, choose File > New Project and then do the following in the New Project wizard:
Under Categories, select Web.
Under Projects, select Web Application with Existing Sources.
Click Next.
In the Add Existing Sources pane, click Browse for the Location field, and select the folder that contains all the sources
for your existing web application.
After the folder is selected, the values for the Project Name and Project Folder fields are automatically filled in.
You see an error message Project Folder already contains 'build folder'.
Change the value in the Project Folder field to another location to store your new web project source files.
In the Add to Enterprise Application field, select None from the drop-down list.
In the Server field, select Open Source Portlet Container from the drop-down list.
In the Java EE Version field, select Java EE 5 from the drop-down list and check the Set as Main Project checkbox.
The Context Path field is automatically populated by using the value in the Project Name field, as shown in the following figure.
Check Set as Main Project and click Next.
Notice that in the Existing Sources and Libraries pane, the Web Pages Folder and WEB-INF Content fields already have values with the following format:
Web Pages Folder = /<projectName_directory>/web
WEB-INF Content = /<projectName_directory>/web/WEB-INF
Leave the Libraries Folder field blank.
Notice that the Sources Package Folders field is automatically filled with the list of source files found in the <projectName_directory>/build/web/WEB-INF/classes.
Leave the Test Package Folders field blank and click Finish, as shown below.
Figure 11: Existing Sources and Libraries Pane With Values Set
Your new NetBeans portlet project is now created and a new node in the Projects window is added.
In the Projects window, right-click the node for your portlet application and select Properties.
In the Categories pane, select the Libraries node and click Add Library in the Compile tab on the right pane.
In the Add Library dialog, select the Portlet 1.0 (JSR 168) Library and click Add Library.
The new node is added to the list of Compile-time Libraries in the Properties dialog.
Click OK in the Properties dialog.
You may now select the portlet container to use and deploy your application
In the Projects tab, expand the node for your new portlet application.
Expand the Web Pages > WEB-INF node and double-click on the suweb.xml node to open the file.
The file is opened in the source editor, as shown next.
Figure 12: Edit sun-web.xml in the Source Editor Window
Delete /portlet from the Context Root text field.
Back in the Projects window, double-click on the web.xml node to open the file.
Click XML on the editor toolbar and modify the web.xml file so that the contents look like the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.&//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>
Choose File > Save All.
In the Projects window, right-click the project's node.
Click Clean and Build in the pop-up menu.
After the build is completed, right-click the project's node again and click Run.
The Open Source Portlet Container is started in a browser if it is not already running and the portlet application is deployed to the Open Source Portlet Container. The Portlets tab of the Portlet Container Driver starts at: http://localhost:8080/portletdriver/dt.
View a Single Portlet
When developing portlet applications inside the NetBeans IDE 6.0, you can deploy and view the output of a single deployed portlet by using the steps below.
In the Services window, expand the Servers node.
Expand the OpenPortal Portlet Container 2.0 > Global > Portlets node.
Right-click one of the portlets and choose Show Portlet from the pop-up menu.
The portlet application you selected will launch in a browser at:
http://localhost:8080/portletdriver/ospc?pc.portletId=<portletName.portlet>.
View All Portlets by Using the Admin Tool
If you want to see the output of all the portlets deployed on the Portlet Container, use the following steps:
In the Services window, select the Servers node.
Right-click the node for the OpenPortal Portlet Container 2.0 instance and click Admin Tool.
The Admin Tool (the Admin tab of the Portlet Container Driver) starts in a
browser at: http://localhost:8080/portletdriver/admin, which lists all of the
portlets deployed to the Open Source Portlet Container.
If
your migrated project was originally deployed on the Sun Java System Application Server,
you can deploy the project in the NetBeans IDE 6.0. If you originally deployed your application to a server other than the Sun Java System
Application Server, then you need to make modifications to your application.
You can create completely new projects with the same functionality in NetBeans IDE
6.0 as in Java Studio Enterprise 8.1. Use the following NetBeans IDE 6.0 tutorials to walk
you through the steps: