• 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

problem in saving a servlet prog..

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everybody, i am new to servlets. i have installed j2ee5.0 sdk in my system and tried to compile a helloworld servlet program. i do not know where to save my program in the sdk directory. i have tried it saving in bin directory but my program gave err saying, "javax.servlet package does not exist".
once i get a class file, i know how to deploy my servlet.
please tell me the exact path to save my program so that i could compile it.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can keep your source code wherever you want to. It does not need to be in the SDK directory, and I would advise NOT to keep it there.

In order to compile servlets, you need to have the jar file containing the servlet API in your classpath. You can do this by compiling like this:

javac -classpath C:/path/to/jee/sdk/servlet-api.jar MyServlet.java
 
venkatesh badrinathan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks ulf, but i did not find servlet-ai.jar file in my system.
i have all the setup files that i have mentioned below.
j2eesdk-1_4_03-windows
j2eesdk-1_4_03-windows-ml
java_ee_sdk-5_05-windows
let me uninstall the old setups then.
please let me know which of them should i install so that i can go ahead with servlets.
thanks in advance..
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go with the JEE 5 installer; JEE 5 is a newer version than J2EE 1.4.

The jar file may be named something else. Just look through the jar files that get installed. One of them has the classes you need.
 
venkatesh badrinathan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
am sorry. i have spent most of the time to find out that jar file to compile my servlet, but could not figure it out. also tried saving the prog everywhere the in directory, but nothing worked out.. is there any other way please..
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said, the directory where you save your source code doesn't matter. But it's better NOT to mix it up with the SDK itself.
The classpath determines where the compiler looks for missing classes. See this tutorial for more detail on that.

Which jar files did you find? Post the names, and we may be able to point out the one you're missing. You can also use the "jar tf" option of the "jar" command to look into jar files (and thus learn which classes they contain).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic