Solved

setting path and javahome from jdk and servlets

Posted on 2002-04-14
11
336 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
Comment Utility
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
Comment Utility
engine your using = engine you're using
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
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
 
LVL 1

Expert Comment

by:naveeth
Comment Utility
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
Comment Utility
thats what corey already said to try.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Expert Comment

by:naveeth
Comment Utility
where is the code?
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
> 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
Comment Utility
agreed,I try to added my way of setting class path ,any problem ? I am sorry
0
 
LVL 2

Expert Comment

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

-corey
0
 

Author Comment

by:anmadhu
Comment Utility
good
0
 

Expert Comment

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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now