Oracle GlassFish Server 3.0.1 Embedded Server Guide

ProcedureTo Run Embedded GlassFish Server from the Command Line

After you have written a class that uses the GlassFish ServerEmbedded 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 GlassFish 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 GlassFish 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 GlassFish Server until embedded GlassFish Server is stopped.


Example 11 Running Embedded GlassFish Server

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


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