如何编译Applet文件(100分)

  • 主题发起人 主题发起人 郭玉梁
  • 开始时间 开始时间

郭玉梁

Unregistered / Unconfirmed
GUEST, unregistred user!
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWWW extends HttpServlet {
public voiddo
Get(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println(.....)
}
}
我用C:/j2ee>Javac -classpath HelloWWW.java 系统没动静
用Javac HelloWWW.java 编译系统又找不到类,谁告诉我则么回事
还有我用 Javac -classpath 任意一个文件名,系统居然没有动静
如何才能生成HelloWWW.class文件
 
This is a servlet, you should have servlet package installed before you can
compile the file. For example, if you install your servlet support classes
into <servlet_class_file>, you can compile your source code with:
javac -classpath <servlet_class_file> HelloWWW.java
 
[green]呵呵,不懂!我对这个也有点儿兴趣![/green]
 
i have installed servlet package before compiling the file.
i can complie java application including 'javax.servlet.*'
but failed to complie java servlet? why ?
 
Post the error messages appear in the console screen
 
There no error message on the console screen
for example:
c:/j2ee>javac -classpath HelloWWW.java
c;/j2ee>
for another example:
c:/j2ee>javac -classpath HelloXXX.java
c:/j2ee>
but the file 'HelloXXX.java' is nothing! why?
 
You misunderstood the option "classpath" of javac.
The classpath option indicate locations of some additional
classes (called "user classes" in the help screen).
In this case, you want to compile source file "Hellowww.java"
with servlet package. Assume that you install your servlet
package in c:/servlet_ext (that's, you have a file named
"servlet.jar" placed in c:/servlet_ext directory), you can
compile your source by typing the following command:
javac -classpath c:/servlet_ext/servlet.jar Hellowww.java
If there's anything wrong, the error message would follow
 
后退
顶部