Hello! I can't compile my first servlet. I've already set my classpath and it point to servlet.jar and jasper.jar. When I try to compile my servlet using javac HelloWorld.java , the error is "Bad command or file name". I can't understand why this is the case. Hope you could help me. Thank you, Tina Ang
in other words... if you're in Windows, you need to set you PATH variable set PATH=%PATH%;c:\jdk1.3.1\bin (or whatever directory you've installed the JDK to) [ June 06, 2002: Message edited by: Jessica Sant ]
Thank you. I already did that. I've also included c:\jdk1.3.1\bin in th autoexec file. When I compiled the servlet using javac HelloWorld.java , it does not recognize the classes from the javax.servlet and javax.servlet.http packages. Need your help...Thanks.. Tina Ang
can you provide the EXACT command you're typing. the EXACT error message, as well as your %CLASSPATH% and %PATH% environment variables. (You can display their values by typing set PA and set CL from the command prompt)?? That will help us be able to determine the cause of the problem you're having.
Tina Ang
Ranch Hand
Joined: Mar 12, 2002
Posts: 58
posted
0
Here it is. autoexec file: PATH=%PATH%;.;C:\jakarta-tomcat-3.3.1\jakarta-tomcat-3.3.1\lib\common\servlet.jar;C:\jakarta-tomcat-3.3.1\jakarta-tomcat-3.3.1\lib\container\jasper.jar;C:\jdk1.3.1\bin; In command prompt: c:\jakarta-tomcat-3.3.1\jakarta-tomcat-3.3.1\webapps\root\web-inf\classes\javac HelloWorld.java 6 Errors one of which is: HelloWorld.java7: cannot resolve symbol symbol: class HttpServletRequest location: class HelloWorld public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Thank you! Tina
tom mcmorrow
Ranch Hand
Joined: Jan 11, 2002
Posts: 39
posted
0
hi tina i feel you may be confusing CLASSPATH with PATH. servlet.jar needs to be placed in the CLASSPATH so the compiler can locate the classes therin rather than the PATH where executables are placed. try on command line as follows- set CLASSPATH=%CLASSPATH%;C:\jakarta-tomcat-3.3.1\jakarta-tomcat-3.3.1\lib\commom\servlet.jar; and then try compiling as you have. hope this helps. tom
Tina Ang
Ranch Hand
Joined: Mar 12, 2002
Posts: 58
posted
0
thanks tom! Here's what I did: set CLASSPATH=%CLASSPATH%;C:\jakarta-tomcat-3.3.1\jakarta-tomcat-3.3.1\lib\commom\servlet.jar; path = c:\jdk1.3.1\bin\ c:\jakarta-tomcat-3.3.1\jakarta-tomcat-3.3.1\webapps\root\web-inf\classes\javac HelloWorld.java GOT THE SAME 6 ERRORS!!! HELP!!!
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
1
posted
0
i had so much trouble with this myself that i downloaded Forte (a free IDE for Jave). i dont use it much for creating but i use it to compile. it takes care of all the Classpath stuff for you
SCJP
Tina Ang
Ranch Hand
Joined: Mar 12, 2002
Posts: 58
posted
0
It's weird that the above procedure didn't work. Anyway a friend of mine told me to copy servlet.jar in C:\jdk1.3.1\jre\lib\ext and it worked... Thank you!!! Tina Ang SCJP2