Problem With JDK1.3 -- I Posted Before, But Could Not Get A Solution
JiaPei Jen
Ranch Hand
Joined: Nov 19, 2000
Posts: 1309
posted
0
My Java programs with "import statment" get compiled without problem using JDK 1.2.2. However, when I use JDK 1.3, I have "cannot resolve symbol" error messages. I have personally tried three things: 1. download JDK1.3 again 2. compile the program by typing javac -classpath c:\jdk1.3\jre\lib\rt.java ProgramName.java 3. set my autoexec.bat file c:\jdk1.3;c:\jdk1.3\bin; none of the three attemps worked. But the same java program compiled fine if I use JDK1.2.2 instead. I really need your wisdom. To be specific: This program (see below) (and my many other Servlets programs) were compiled using JDK 1.2.2 without problem. When I use JDK 1.3 to compile this program, I got six error messages (error messages are listed after the program). import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class ThreeParams extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = "Reading Three Request Parameters"; out.println("" + "\n" + "\n" + "\n" + "\n" + " " + title + " \n" + " \n" + " param1: " + request.getParameter("param1") + "\n" + " param2: " + request.getParameter("param2") + "\n" + " param3: " + request.getParameter("param3") + "\n" + " \n" + ""); } } error message: The first two error messages point at import javax.servlet.*; import javax.servlet.http.*; The other four error messages are: ThreeParams.java:17: cannot resolve symbol symbol: class HttpServlet location: class ThreeParams public class ThreeParams extends HttpServlet { (an arrow point at the 'H' of HttpServlet) ThreeParams.java:19: cannot resolve symbol symbol: class HttpRequest location: class ThreeParams public void doGet( HttpServletRequest request, (an arrow points at the 'H' of HttpServletRequest) ThreeParams.java:20: cannot resolve symbol symbol: class HttpServletResponse location: class ThreeParams HttpServletResponse response ) (an arrow points at the 'H' of HttpServletResponse) ThreeParams.java:21: cannot resolve symbol symbol: class ServletException location: class ThreeParams throws ServletException, IOException { (an arrow points at the 'S' of ServletException)
Peter Tran
Bartender
Joined: Jan 02, 2001
Posts: 783
posted
0
JiaPei, This isn't a JDK problem with 1.2.2. vs 1.3. To compile Servlets, you need Tomcat. With 1.2.2, your classpath probably had the servlet.jar file set correctly. You're missing this jar file when you compile your program with JDK1.3. Go search for it somewhere on your HD, and add it to your classpath. Read this article on writing Servlets. NOTE the second paragraph. -Peter
[This message has been edited by Peter Tran (edited January 18, 2001).]
JiaPei Jen
Ranch Hand
Joined: Nov 19, 2000
Posts: 1309
posted
0
Mr. Tran: Would you kindly tell me the hyperlink of "this" in you reply? I clicked on "this" and could not get that page displayed. Thank you in advance. JiaPei Jen
Peter Tran
Bartender
Joined: Jan 02, 2001
Posts: 783
posted
0
JiaPei, I modified the hyperlink to the entire sentence. -Peter Ps. You can also click on the edit my posting to see the entire URL. [This message has been edited by Peter Tran (edited January 18, 2001).]