Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.drools.guvnor;
 
 import java.io.File;
 
public class JettyLauncher {
    public void launch(String[] argsthrows Exception {
        File jettyConf;
        if (args.length == 1) {
            jettyConf = new File(args[0]);
            if (!jettyConf.exists()) {
                throw new FileNotFoundException("Jetty config file " + args[1] + " not found!");
            }
        } else {
            jettyConf = new File("jetty.xml");
            if (!jettyConf.exists()) {
                throw new FileNotFoundException("jetty.xml must present in working directory!");
            }
        }
        try {
            Method mainMethod = getJettyServerClassName().getMethod("main"new Class[]{String[].class});
            mainMethod.invoke(nullnew Object[]{new String[]{jettyConf.getAbsolutePath()}});
        }
        catch (ClassNotFoundException e) {
            ..println("You don't have Jetty in the classpath, cannot proceed!");
        }
    }
        try {
            ..println("starting jetty5...");
            return Class.forName("org.mortbay.jetty.Server"); // jetty 5
        }
        catch (ClassNotFoundException e) {
            ..println("jetty5 failed: " + e.getMessage());
            ..println("starting jetty4...");
            return Class.forName("org.mortbay.start.Main");// jetty 4 and early versions
        }
    }
    public static void main(String[] argsthrows Exception {
        new JettyLauncher().launch(args);
    }
New to GrepCode? Check out our FAQ X