.classpath:
<classpathentry kind="output" path="WebContent/WEB-INF/classes"/
修改输出路径:
<classpathentry kind="output" path="WebContent/dateView/WEB-INF/classes"/>
新增的依赖jar:
jasper-compiler.jar
jasper-runtime.jar
javax.servlet.jar
org.mortbay.jetty.jar
org.mortbay.jmx.jar
tomcat-juli.jar
jasper-runtime.jar
javax.servlet.jar
org.mortbay.jetty.jar
org.mortbay.jmx.jar
tomcat-juli.jar
JettyLauncher.java:
import org.mortbay.http.SocketListener;
import org.mortbay.jetty.Server;
public class JettyLauncher {
protected int port = 8081;
protected String contextName = "dateView";
protected String deployPath = "";
public static void main(String[] args) throws Exception {
JettyLauncher jl = new JettyLauncher();
jl.init();
jl.run();
}
protected void init() {
}
protected void run() throws Exception {
Server server = new Server();
SocketListener listener = new SocketListener();
listener.setPort(getPort());
server.addListener(listener);
server.addWebApplication("/" + getContextName() , getDeployPath());
server.start();
}
protected int getPort() {
return port;
}
protected String getContextName() {
return contextName;
}
protected String getDeployPath() {
if (deployPath.length() == 0) {
deployPath = "./WebContent/" + contextName + "/";
}
return deployPath;
}
}
项目截图:
![](https://i-blog.csdnimg.cn/blog_migrate/acbc905bf420a3c34cb9b60e652f3889.png)