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.
Ensure that the following prerequisites are met:
A distribution of embedded GlassFish 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 GlassFish 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 GlassFish 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 GlassFish Server until embedded GlassFish Server is stopped.
This example shows the command for running embedded GlassFish Server as follows:
The embedded GlassFish Server JAR file is glassfish-embedded-all.jar.
The user class file is myembed.class.
java -jar glassfish-embedded-all.jar myembed.class |