Solved

setting path and javahome from jdk and servlets

Posted on 2002-04-14
11
343 Views
Last Modified: 2013-11-24
I installed  the jdk1.3 and  javawebserver2.0 in  my sytem. I set the path as f:\jdk1.3\bin; f:\javawebserver2.0\bin;  and i set the javahome as jdk1.3;

Then i wrote a simple standalone program(hello program). it worked perfectly. then i wrote a servlet program. i tried to compile the program. i got the error.
i installed the jdk and javawebserver in F drive.
my program is in
d:\aaaa\bbbb\ccccc\Home.java (servlet program).


the error is
package javax.servlet does not exist
import javax.servlet.*;
^
package javax.servlet.http does not exist
import javax.servlet.http.*;
^
please could you help me?
thanking you
0
Comment
Question by:anmadhu
  • 3
  • 3
  • 3
  • +2
11 Comments
 
LVL 2

Accepted Solution

by:
coreyit earned 200 total points
ID: 6939804
I believe that the javax.servlet package is not part of the standard jdk. Typically the package is delivered via the servlet engine your using (java web server). That application should have s jar file (servlet.jar) that contains the classes for javax.servlet and subpackages. Make sure that servlet.jar is included in your classpath for compilation.

-corey
0
 
LVL 2

Expert Comment

by:coreyit
ID: 6939805
engine your using = engine you're using
0
 
LVL 92

Expert Comment

by:objects
ID: 6940780
corey is right it is not a part of standard jdk (J2SE). It is included as a part of enterprise jdk (J2EE) available from sun.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Expert Comment

by:naveeth
ID: 6941066
try running  this as batch file before compiling

set classpath = %classpath%; f:\javawebserver2.0\lib\servlet.jar;

regards
0
 
LVL 92

Expert Comment

by:objects
ID: 6941085
thats what corey already said to try.
0
 
LVL 1

Expert Comment

by:naveeth
ID: 6941090
where is the code?
0
 
LVL 92

Expert Comment

by:objects
ID: 6941101
> where is the code?

What code??? servlet.jar just needs to be included in the classpath, and there are many ways to do this. And it doesn't necessarily even require any code, in fact the preferable solution, which is to include it in your classpath at startup, does not.
0
 
LVL 1

Expert Comment

by:naveeth
ID: 6941119
agreed,I try to added my way of setting class path ,any problem ? I am sorry
0
 
LVL 2

Expert Comment

by:coreyit
ID: 6942776
For some classpath setting guidelines, see:
http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html

-corey
0
 

Author Comment

by:anmadhu
ID: 7004692
good
0
 

Expert Comment

by:coysting
ID: 8117542
I met similar problem and solve it by adding servlet.jar offered by Tomcat to classpath.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
factorial example 4 40
javap not working 8 46
Eclipse with gitlab 1 43
how to see all occupied ports on windows 10 laptop 15 65
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question