Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Servlet

 
Sunita Vontel
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My autoexec file looks like this
PATH C:\JDK1.2.1\BIN;C:\JSDK2.0\BIN;C:\JSDK2.0\src
SET CLASSPATH = .;c:\jsdk2.0\lib\jsdk.jar;C:\JDK1.2.1\LIB;C:\JSDK2.0\src;c:\jsdk2.0\lib
I am trying to run a servlet and I am getting the error
Package javax.servlet not found in import
Package javax.servlet.http not found in import.
Can somebody please tell me how to set the path or classpath so that my program runs fine.
Thanks
Sunita
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not using JSDK but!
remember that the servlet classes are "standard extensions" which belong in the
\JDK1.2\jre\lib\ext
directory. Java 1.2 does NOT have to have classpath set to find the standard extensions OR the standard library jar files.
See the tooldocs documentation.
Why are you using JSDK instead of Tomcat?
Bill
 
Sunita Vontel
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William
I did not know about Tomcat.
But I just tried
javac -classpath c:\jsdk2.0\lib\jsdk.jar file.java
and it worked.Probably my classpath is not set correctly.

Sunita
 
Sunita Vontel
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William
I did not know about Tomcat.
But I just tried
javac -classpath c:\jsdk2.0\lib\jsdk.jar file.java
and it worked.Probably my classpath is not set correctly.

Sunita
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic