• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

import javax.servlet.*;

 
Ayman Jaffar
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I've made a simple file.It works fine, but when I add this statement "import javax.servlet.*;" the compiler objects and says there's no such package. I've downloaded jdk1.3 so why is this happening?
 
madhesh raj
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Servlet & JSP APIs are not a part of JDK... You need to install these -- install JSDK/JSWDK/JWS... JSWDK is simple and easy to use with almost all features of JWS. After installing you need to put your servlet.jar in your classpath.
For eg.. if you installed jswdk in c:. You will have a directory like c:\jswdk-1.0.1 created which will have all your files. The servlet.jar is in the lib subdirectory. So, add this to your classpath (autoexec.bat -> WIN95)
set classpath = %classpath%;c:\jswdk-1.0.1\lib\servlet.jar;
Regards
Madhesh
 
Kavita Ghia
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaffar,
Madhesh is right.Servlet development kit and jdk1.3 are separate.
Infact servlets had come much later then jdk1.1 had come.So Sun decided to put new features of java in a separate package rather than making it a part of JDK.Therefore u will have to download JSWDk-1.0.1 and set its path as Madhesh as stated.
Regards,
Kavita
 
Ayman Jaffar
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, but I have tomcat and I've included "servlet.jar (of tomcat)" file in my classpath of the autoexec.bat file this:
set CLASSPATH = %CLASSPATH%;c:\jdk1.3\lib\tools.jar
set CLASSPATH = %CLASSPATH%;c:\tomcat\lib\servlet.jar;c:\tomcat\lib\jasper.jar
So if tomcat already has a servlet.jar for "javax.servlet" then why do I need jswdk 1.0.1
And if i don't need jswdk 1.0.1 then why isn't my simple program working!
[This message has been edited by Ayman Jaffar (edited December 01, 2000).]
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you missed to setup the JAVA_HOME and TOMCAT_HOME env. variable. Please check this thread http://www.javaranch.com/ubb/Forum7/HTML/001111.html for some more info.
regds
maha anna
[This message has been edited by maha anna (edited December 01, 2000).]
 
P SOLAIAPPAN
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
When "servlet.jar" is class path, why the servlet program is not compiling ? Problem is somewhere else.
By the way are you using any IDE for compiling or simply you are using MSDOS prompt for compiling. Type "set" command in MSDOS prompt check up your class path. If you use any IDE you may have to add class path for the IDE set up (for TEXT PAD there is no need to add)
solaiappan
 
Ayman Jaffar
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm using MSDos prompt for compiling, and here is my autoexec.bat I wonder if I'm missing anything.
SET BLASTER=A220 I7 D1 H7 P330 T6
SET SBPCI=C:\SBPCI
C:\PROGRA~1\NETWOR~1\DRSOLO~1\FINDVIRU.EXE C:\
@IF ERRORLEVEL 1 PAUSE
SET PATH=C:\JDK1.3\Bin;"%PATH%"
PATH=%PATH%;

PATH=%PATH%;
set TOMCAT_HOME = c:\tomcat
set JAVA_HOME = c:\jdk1.3
set PATH = %PATH%;c:\tomcat\bin
set CLASSPATH = %CLASSPATH%;c:\jdk1.3\lib\tools.jar
set CLASSPATH = %CLASSPATH%;c:\tomcat\lib\servlet.jar;c:\tomcat\lib\jasper.jar
----------------------------
my tomcat is in c:\tomcat
my jdk1.3 is in c:\jdk1.3
If all is okay. maybe I should unzip tomcat again. Of course I don't think I can download it again becsause they've released tomcat V.3.2
 
P SOLAIAPPAN
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It looks like that you donot have "servlet.jar" file in your class path ie. in "c:\tomcat\lib\" directory. Check up the directory or use find command in start menu to search "servlet.jar' in C: drive.
solaiappan
 
Ayman Jaffar
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have "servlet.jar" in my "c:\tomcat\lib" directory, I checked it and rechecked it manually and through using find, again.
Any suggestions ?
Also when I stop tomcat I get an exception, is that suppose to happen ?
Thanks.
[This message has been edited by Ayman Jaffar (edited December 02, 2000).]
 
myselff
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to get this garbage to work with the same problem for a while now. I can't get an answer froma anywhere and I have come to the conclusion that java and sun really suck ass when it comes to web apps of any kind. Goes to show why microsoft is taking over, and java in general is losing steam.
The Search Goes On...
 
Sophia Oscario
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...
Do you use Win 98 or Win 95 as your OS ?
I got the same problem like you when I use Win 98 on my computer.
But then the problem is gone when I change into Win 2000, I also try to test it on Win NT machine and there's no problem with it.
Some friends of mine also got it right this way.
Maybe this is not a good solution, just want you to know.
See ya

------------------
** Science belongs to the world **
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a cleanly booted computer, open a DOS window and type set.

Tell us what you get.

If you classpath doesn't include the servlet.jar package, then your autoexec.bat isn't working right.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic