aspose file tools*
The moose likes Servlets and the fly likes compiling servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "compiling servlet" Watch "compiling servlet" New topic
Author

compiling servlet

Atif Malik
Greenhorn

Joined: Nov 21, 2005
Posts: 4
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
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

There is one in our FAQ:
http://faq.javaranch.com/view?CompilingServlets


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Navatha Cheguri
Greenhorn

Joined: Nov 21, 2005
Posts: 5
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61001
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Atif Malik
Greenhorn

Joined: Nov 21, 2005
Posts: 4
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

Joined: Nov 21, 2005
Posts: 4
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61001
    
  65

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compiling servlet