HelloWorld.java:1: package Java.io does not exist

pwtitle 2004-09-07 04:16:47
已经装了j2sdk1.4
下面程序编译的时候
import Java.io.*;
import Java.util.*;
import Javax.Servlet.*;
import Javax.Servlet.http.*;
public class HelloWorld extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
String title = "Hellow World!";
out.println("<title>"+ title +"</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>"+ title +"</h1>");
out.println("</body>");
out.println("</html>");
}
};

出现以下错误,谁能帮助我?
C:\j2sdk\bin>javac HelloWorld.java
HelloWorld.java:1: package Java.io does not exist
import Java.io.*;
^
HelloWorld.java:2: package Java.util does not exist
import Java.util.*;
^
HelloWorld.java:3: package Javax.Servlet does not exist
import Javax.Servlet.*;
^
HelloWorld.java:4: package Javax.Servlet.http does not exist
import Javax.Servlet.http.*;
^
HelloWorld.java:5: cannot resolve symbol
symbol : class HttpServlet
location: class HelloWorld
public class HelloWorld extends HttpServlet
^
HelloWorld.java:7: cannot resolve symbol
symbol : class HttpServletRequest
location: class HelloWorld
public void doGet(HttpServletRequest request,HttpServletResponse respon
e)
^
HelloWorld.java:7: cannot resolve symbol
symbol : class HttpServletResponse
location: class HelloWorld
public void doGet(HttpServletRequest request,HttpServletResponse respon
e)
^
HelloWorld.java:8: cannot resolve symbol
symbol : class IOException
location: class HelloWorld
throws IOException,ServletException
^
HelloWorld.java:8: cannot resolve symbol
symbol : class ServletException
location: class HelloWorld
throws IOException,ServletException
^
HelloWorld.java:11: cannot resolve symbol
symbol : class PrintWriter
location: class HelloWorld
PrintWriter out = response.getWriter();
^
10 errors

C:\j2sdk\bin>
...全文
82 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
imA 2004-09-07
import javax.servlet.*;
你得自己添加这个包,这个包在标准的jdk中不包含,不是书有错,是你看的不够自习。书上肯定说了:让你自己引入某个包。
我实在太ft了。你这样的贴该删!!!!!!!!!!!!!
回复
joy_jiang 2004-09-07
Java.io.*;中的J是大写的,强!
这种书也能出来,我们鄙视这种工作态度!!!
回复
bestdelphier 2004-09-07
书为什么就不能有错?书还不是人写的?
回复
imA 2004-09-07
我狂吐!!!!!!!
java中的包名没有大写的。我靠!!!!!!!!!!!!!!!!!
回复
pwtitle 2004-09-07
C:\j2sdk\bin>javac HelloWorld.java
HelloWorld.java:3: package javax.Servlet does not exist
import javax.Servlet.*;
^
HelloWorld.java:4: package javax.Servlet.http does not exist
import javax.Servlet.http.*;
^
.............
这个例子我是从书上抄的。难道书有错?
回复
LxcJie 2004-09-07
import java.io.*;
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2004-09-07 04:16
社区公告
暂无公告