import org.glassfish.embeddable.*; import java.io.*; import java.net.*; /** */ public class JspTest { public static void main(String... args) throws Exception { /* IF YOU START THIS WAY, JSPS WORK GlassFishProperties props = new GlassFishProperties(); props.setPort("http-listener", 8080); GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish(props); glassfish.start(); */ GlassFishRuntime gfRuntime = GlassFishRuntime.bootstrap(); // JSPS DON'T WORK IF YOU SET INSTANCEROOT String instanceRoot = "/Users/Amy/3.1.2-minnow/3.1.2-minnow/distributions/glassfish/target/glassfish3/glassfish/domains/domain1"; GlassFishProperties gfProps = new GlassFishProperties(); gfProps.setPort("http-listener", 8080); gfProps.setInstanceRoot(instanceRoot); GlassFish glassfish = gfRuntime.newGlassFish(gfProps); glassfish.start(); Deployer deployer = glassfish.getDeployer(); String appName = deployer.deploy(new File("hello.war")); System.out.println("Successfully deployed [ " + appName + " ]"); System.out.println("Press any key to exit."); new BufferedReader(new InputStreamReader(System.in)).readLine(); glassfish.dispose(); } }