This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes servlet compiling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet compiling " Watch "servlet compiling " New topic
Author

servlet compiling

sridurga vuppu
Greenhorn

Joined: Oct 15, 2000
Posts: 7
Hi,
I am new to servlets and getting problem in compiling the servlets. my jdk is in d:\java2 and jsdk in d:\jsdk2.0. I have set the classpath as set classpath = "d:\java2\lib\tools.jar";"d:\jsdk2.0\lib\jsdk.jar";%classpath%;
and set the path as set path="d:\java2\bin";"d:\jsdk2.0\bin";
when i try to compile a simple servlet , i am getting errors like package javax.servlet not found in import. can anyone help me regarding this problem?
Sridurga
S Chandra Mohan
Ranch Hand

Joined: Oct 19, 2000
Posts: 75
Hello SriDurga,
There is some problem with ur classpath settings.
Better remove %classpath% and include other .jar files
in classpath available in 'lib' directory.
For time being copy ur .java prg in 'src' directory and
copy the .class file in 'examples' directory.
All the best and feel free to contact.
Regards
S Chandramohan


Have a wonderful day and wish u success<p>S Chandra Mohan<br />sc_mohan_us@yahoo.com
Muzaffar Reshi
Greenhorn

Joined: Oct 30, 2000
Posts: 2
Dear Chandru!
Set your classpath as
set classpath=d:\jsdk2.0\src
it will work definitly if not contact back.
Muzaffar Reshi
Greenhorn

Joined: Oct 30, 2000
Posts: 2
Dear
Set your classpath as
set classpath=d:\jsdk2.0\src
it will work definitly if not contact back.
sridurga vuppu
Greenhorn

Joined: Oct 15, 2000
Posts: 7
Hi ChandraMohan ,
I got it compiled atlast. we have to compile as javac -cclasspath d:\jsdk2.0\lib\jsdk.jar sourcefile.java. it also works fine as Muzzafar has said.
thankyou
sridurga
Nitin Dabadghav
Greenhorn

Joined: Jun 28, 2000
Posts: 13
set the classpath to
d:\jsdk2.1\src
You cannot go on compiling you servlets using a -classpath always.
Simply give set the classpath as given above and tehn compile your servlet using JAVAC.
sridurga vuppu
Greenhorn

Joined: Oct 15, 2000
Posts: 7
hi,
it's not working by setting classpath as d:\jsdk2.0\src; is there any permanent solution so that i can compile servlets without running javac -classpath d:\jsdk2.0=lib\jsdk.jar sourcefile.java always
thanks if anyone can help me
durga
Rajpal Kandhari
Ranch Hand

Joined: Aug 26, 2000
Posts: 126
Hello Sridurga,
The way you have set you're classpath and path is fine. The problem you r having is the package problem. That is when you are compiling you're servlet Java code you r getting error javax.servelt.*, or javax.servlet,http.* could not found in import. In the sub-directory of you're d:\jsdk2.0\src directory there is one directory name javax. Copy this directory where you're servelt Java code is. Once javax directory is in the folder with you're servlet code run you're code again. This time it should detect you're javax package and you're code will compile as "javac filename.java", no need of using -classpath option.
I think this problem is there when some one is using jdk2.0 and jsdk2.0. But this approach is not necessary when you r working with jdk2.2 and Jsdk2.2.In this case suggestion put up by other fellow will work fine.
In case you are having any problem then feel free to contact me.
Regards,
Raj.

Regards,<P>Raj.<BR>-------------------------<BR>Afforts should be Appriciated.<BR>-------------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet compiling