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.
Ensure that the following prerequisites are met:
A distribution of embedded Enterprise Server is downloaded.
A user-created class file that uses the Embedded Server API to start the server, deploy your applications, and stop the server is written.
Run embedded Enterprise Server in the Java application launcher, specifying the applications to deploy.
java -jar glassfish-embedded-jar embedded-class |
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.
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.
This example shows the command for running embedded Enterprise Server as follows:
The embedded Enterprise Server JAR file is glassfish-embedded-all.jar.
The user class file is myembed.class.
java -jar glassfish-embedded-all.jar myembed.class |