简体   繁体   English

在命令提示符下编译并运行Servlet

[英]Compile and run Servlet from command prompt

It's straightforward. 很简单。 I want to compile all class when make a web application with Servlet and Jsp. 当使用Servlet和Jsp创建Web应用程序时,我想编译所有类。 pure 100% command prompt. 纯100%命令提示符。 How do I do that? 我怎么做? Someone can give me some demo or any document? 有人可以给我一些演示或任何文件吗?

You should use a tool that combine compilation, resource management, building of the war and optionnaly deployment. 您应该使用结合了编译,资源管理,战争建设和可选部署的工具。 ant is a nice tool, but you could also use maven . ant是一个很好的工具,但是您也可以使用maven The latter is less configurable but more straightforward. 后者的可配置性较差,但更为直接。

Both can be integrated in an IDE (Eclipse or Netbeans), or can be runned directly from command ling. 两者都可以集成在IDE(Eclipse或Netbeans)中,或者可以直接从命令行运行。

compile all servlets then you will get .class files.then put these .class files in classes folder of your application. 编译所有servlet,然后您将获得.class文件。然后将这些.class文件放入应用程序的classes文件夹中。

you need to follow correct directory structure as follows: 您需要遵循以下正确的目录结构:

project_name
        WEB_INF
             classes
             lib
             web.xml
        index.jsp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM