Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compiling servlet

 
Atif Malik
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
 
Navatha Cheguri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic