我运行以下命令从 HeadFirst Servlets 和 JSP 书中编译一个名为 BeerSelect.java 的 servlet。
D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee>javac -classpath /common/lib servlet-api.jar:classes: -d classes src/com/example/网络/啤酒选择.java
我的 servlet-api.jar 位于D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\common\lib
信息
javac: invalid flag: servlet-api.jar:classes:
Usage: javac <options> <source files> use -help for a list of possible options
无法理解如何修复此命令并编译 servlet。第一次做 servlet 的新手。
然后我将命令更改为
D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee\WEB-IN
F\src\com\example\web>javac -classpath "D:\Apache Tomcat\apache-tomcat-5.5.36\ap
ache-tomcat-5.5.36\common\lib\servlet-api.jar";classes BeerSelect.java
信息
BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:32: cannot find symbol
symbol : variable out
location: class com.example.web.BeerSelect
out.println("<br>try: " + it.next());
^
4 errors
为什么找不到 com.example.model 包?