This chapter gives guidelines for setting up an application development environment in the Oracle GlassFishTM Server. Setting up an environment for creating, assembling, deploying, and debugging your code involves installing the mainstream version of the GlassFish Server and making use of development tools. In addition, sample applications are available. These topics are covered in the following sections:
For more information about GlassFish Server installation, see the Oracle GlassFish Server 3.0.1 Installation Guide.
The following components are included in the full installation.
GlassFish Server core
Java Platform, Standard Edition (Java SE) 6
Java EE 6 compliant application server
Other development and deployment tools
GlassFish Message Queue software
Java DB database, based on the Derby database from Apache
The NetBeansTM Integrated Development Environment (IDE) bundles the GlassFish edition of the GlassFish Server, so information about this IDE is provided as well.
Locate utility classes and libraries so they can be accessed by the proper class loaders. For more information, see Using the Common Class Loader.
Set up debugging. For more information, see Chapter 4, Debugging Applications.
Configure the Virtual Machine for the JavaTM platform (JVMTM software). For more information, see Chapter 4, Administering the Virtual Machine for the Java Platform, in Oracle GlassFish Server 3.0.1 Administration Guide.
The following general tools are provided with the GlassFish Server:
The following development tools are provided with the GlassFish Server or downloadable from Oracle:
The following third-party tools might also be useful:
The asadmin command allows you to configure a local or remote server and perform both administrative and development tasks at the command line. For general information about asadmin, see the Oracle GlassFish Server 3.0.1 Reference Manual.
The asadmin command is located in the as-install/bin directory. Type asadmin help for a list of subcommands.
The Administration Console lets you configure the server and perform both administrative and development tasks using a web browser. For general information about the Administration Console, click the Help button in the Administration Console. This displays the GlassFish Server online help.
To access the Administration Console, type http://host:4848 in your browser. The host is the name of the machine on which the GlassFish Server is running. By default, the host is localhost. For example:
The GlassFish Server provides server-specific tasks for administration and deployment; see Chapter 3, Using Ant with GlassFishTM Server. The sample applications that can be used with the GlassFish Server use Ant build.xml files; see Sample Applications.
For more information about Ant, see the Apache Software Foundation web site at http://ant.apache.org/.
The GlassFish Server supports a number of scripting languages, including Ruby on Rails and Groovy on Grails. For more information, see the Oracle GlassFish Server 3.0.1 Scripting Framework Guide.
The Migration Tool converts and reassembles Java EE applications and modules developed on other application servers. This tool also generates a report listing how many files are successfully and unsuccessfully migrated, with reasons for migration failure. For more information and to download the Migration Tool, see http://java.sun.com/j2ee/tools/migration/index.html.
The NetBeans IDE allows you to create, assemble, and debug code from a single, easy-to-use interface. The GlassFish edition of the GlassFish Server is bundled with the NetBeans 6.1 IDE. To download the NetBeans IDE, see http://www.netbeans.org. This site also provides documentation on how to use the NetBeans IDE with the bundled GlassFish edition of the GlassFish Server.
You can also use the GlassFish Server with the Java Studio Enterprise software, which is built on the NetBeans IDE. For more information, see http://developers.sun.com/jsenterprise/.
A plug-in for the Eclipse IDE is available at https://glassfishplugins.dev.java.net/. This site also provides documentation on how to register the GlassFish Server and use GlassFish Server deployment descriptors.
You can use several debugging tools with the GlassFish Server. For more information, see Chapter 4, Debugging Applications.
You can use several profilers with the GlassFish Server. For more information, see Profiling Tools.
Sample applications that you can examine and deploy to the GlassFish Server are available. If you installed the GlassFish Server as part of installing the Java EE 6 SDK bundle from Java EE 6 Downloads, the samples may already be installed. You can download these samples separately from the Code Samples page if you installed the GlassFish Server without them initially.
Most GlassFish Server samples have the following directory structure:
The docs directory contains instructions for how to use the sample.
The build.xml file defines Ant targets for the sample. See Chapter 3, Using Ant with GlassFishTM Server.
The src/java directory under each component contains source code for the sample.
The src/conf directory under each component contains the deployment descriptors.
With a few exceptions, sample applications follow the standard directory structure described here: http://java.sun.com/blueprints/code/projectconventions.html.
The samples-install-dir/bp-project/main.xml file defines properties common to all sample applications and implements targets needed to compile, assemble, deploy, and undeploy sample applications. In most sample applications, the build.xml file imports main.xml.
In addition to the Java EE 6 sample applications, samples are also available at GlassFish Samples and at as-install/glassfish/samples/.