• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

servlet compiling

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Chandru!
Set your classpath as
set classpath=d:\jsdk2.0\src
it will work definitly if not contact back.
 
Muzaffar Reshi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear
Set your classpath as
set classpath=d:\jsdk2.0\src
it will work definitly if not contact back.
 
sridurga vuppu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic