安装了JDK后,怎么还没有JAVAX包呢?如何增加?

解决方案 »

  1.   

    是不是程序编译时找不到java包,环境变量设置了吗?
      

  2.   

    环境变量设置为:JAVA_HOME=C:\jdk1.6.0_07,
    程序编译时找不到javaX包。
      

  3.   

    Path里面加;%JAVA_HOME%\bin没有?
      

  4.   

    JAVA_HOME=C:\jdk1.6.0_07;
    Path里面加;%JAVA_HOME%\bin
      

  5.   

    我的电脑环境变量为:
    JAVA_HOME=C:\jdk1.6.0_07
    PATH=%JAVA_HOME%\bin;C:\Program Files\StormII\Codec;C:\Program Files\StormII编译书本上别人的例子:package mypack;import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;public class DispatcherServlet extends HttpServlet {  private String target = "/hello.jsp";  public void init(ServletConfig config)
        throws ServletException {
        super.init(config);
      }  public void doGet(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException {    // If it is a get request forward to doPost()
        doPost(request, response);
      }  public void doPost(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException {    // Get the username from the request
        String username = request.getParameter("username");
        // Get the password from the request
        String password = request.getParameter("password");    // Add the  user to the request
        request.setAttribute("USER", username);
        request.setAttribute("PASSWORD", password);    // Forward the request to the target named
        ServletContext context = getServletContext();    System.out.println("Redirecting to " + target);
        RequestDispatcher dispatcher =
          context.getRequestDispatcher(target);
        dispatcher.forward(request, response);
      }  public void destroy() {
      }
    }是在dos下编译:javac DispatcherServlet.java, 之后就提示软件包javax.servlet不存在,后面还很多出错。
    怎么办?请指点?
      

  6.   

    你去tomcat目录的lib目录下,把jsp-api.jar和servlet-api.jar这两个jar包导入你的工程目录
      

  7.   

    你的Eclipse用的是哪个版本的JDK?是你刚安装过的么?
      

  8.   

    在tomcat里,拷贝jsp-api.jar和servlet-api.jar这两个jar包导入你的工程目录,就有了。