Sun GlassFish Enterprise Server v3 Embedded Server Guide

ProcedureTo Run Embedded Enterprise Server from the Command Line

After you have written a class that uses the Sun GlassFish Embedded Server API to start the server, deploy your applications, and stop the server, you can run this class at the command line.

Before You Begin

Ensure that the following prerequisites are met:

  1. Run embedded Enterprise Server in the Java application launcher, specifying the applications to deploy.


    java -jar glassfish-embedded-jar embedded-class
    
    glassfish-embedded-jar

    The full path to the file that contains your distribution of embedded Enterprise Server: glassfish-embedded-web.jar, glassfish-embedded-all.jar, or glassfish-embedded-static-shell.jar.

    embedded-class

    A user-created class file with a main method that uses the Embedded Server API to start the server, deploy your applications, and stop the server.

    The applications continue to run in embedded Enterprise Server until embedded Enterprise Server is stopped.


Example 11 Running Embedded Enterprise Server

This example shows the command for running embedded Enterprise Server as follows:


java -jar glassfish-embedded-all.jar myembed.class