• 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

compiling servlet

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to JSp and servlets.
I am trying to compile the servlet,as my first example from the book "head first". In the book it shows that for compilation "-d" has to be used in the development environment to place the compiled file inside the class directory. When I try to compile it doesn;t do anything. Instead the compiler asks me use the "javac" properly with proper options.

Is there any easy way to compile this so that I can test my first servelt. by the way I am not using the JSP at this point. I have a JDK 5.0 (J2SE dev Kit 1.5).

I will really appreciate if anyone can help me out here. Or maybe a sight where I can find easy to follow guidelines and steps along with compiles codes.
Thank you
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is one in our FAQ:
http://faq.javaranch.com/view?CompilingServlets
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can compile it normally with out using that -d option and just place the class file in the classes folder manually. just take the package structure out and try to compile it using javac classname.java . that should work. otherwise let me know the command you are using.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

just take the package structure out



No. Do not. Containers are not able to find classes that are not in packages other than the default.
 
Atif Malik
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using tomcat and i have to set the CLASPATH variable. Now if i simply use the javac classname.java it doesn't recognise the servelt classes, which are imported in the code.
if my file "selectBeer.java" is in the directory "c:\app\test" then what will be the CLASSPATH value, using the servlet-api.jar in the tomcat.

thanx
 
Atif Malik
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear I am not sure if I hijacked anyone's question. I am simply trying to continue the conversation based on all the replies. So I am really not sure what I have done wrong here.
But I really appreciate everyone's feedback. The servlet is finally running and I thank you all for that.

Thank you everyone!!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Atif, my apologies. I had thought that you had posted this in a different topic that I was looking at! teach me to try ant multi-task! I deleted my entry.
 
reply
    Bookmark Topic Watch Topic
  • New Topic