• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Servlets not compiling

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
Argh! I am at wits end!
I am trying to compile the simplest of servlets on a Mac Powerbook runing MacOS 10.3.1 and I get this error message:
-> javac Hi.java
Hi.java:4: package javax.servlet does not exist
import javax.servlet.*;
^
Hi.java:5: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Hi.java:11: cannot resolve symbol
symbol : class HttpServlet
location: class Hi
public class Hi extends HttpServlet {
^
Hi.java:13: cannot resolve symbol
symbol : class HttpServletRequest
location: class Hi
public void doGet(HttpServletRequest request,
^
Hi.java:14: cannot resolve symbol
symbol : class HttpServletResponse
location: class Hi
HttpServletResponse response)
^
Hi.java:15: cannot resolve symbol
symbol : class ServletException
location: class Hi
throws IOException, ServletException
^
6 errors
To me (and I could be wrong) it looks like a CLASSPATH problem. Well, my CLASSPATH looks like this:
-> echo $CLASSPATH
/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Classes/classes.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/servlet.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/mail.jar:/.
It looks right to me. What am I missing?
Thanks
Elton
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmmmm.... What goes around comes around
I've simply resigned myself to javac -classpath /usr/local/jakarta etc and am now starting to use ant.
I'm trying to think back to my Unix which I am constantly forgeting, but I've noticed something that I don't think is quie correct about your path... If I'm not mistaken, your /. is wrong, no? shouldn't it just be . ?
C'ya, Michael
[ December 06, 2003: Message edited by: michael bradly ]
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Michael,
lol, I am glad it was you who responded. But, alas, I get the same freakin results! My new (thanks to you, and you were correct) classpath looks like this:
-> echo $CLASSPATH
/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Classes/classes.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/servlet.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/mail.jar:.
But I am still not able to compile a very very simple servlet.
Bloody heck! It is something that would drive a same man to drink!
So, I will relax for a wee bit and then try to look at the problem from a new angle.
But please, if you can think of something else, please let me know!
Elton
 
michael bradly
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, I don't know how to resolve the situation since I'm STILL facing the same issue. I have everything where it should be and I'm still not getting the results I expect. It did give me a need to start working with ant, although I would like to find out what the exact issue is since it's neccessary to know. If you deduce the difference between your box at work and at home let me know, it might give me some insights.
However, I'm beginning to wonder if there....
I guess I should maintain the randomness of my thoughts in writing so...
I went back to the developers page to see if I could clarify a few things..
In the .tcsh profile I created for myself I changed the line:
setenv PATH /usr/local/jakarta-tomcat-4.1.18/common/lib/servlet.jar:$PATH
to
setenv CLASSPATH /usr/local/jakarta-tomcat-4.1.18/common/lib/servlet.jar:$PATH
and now everything works fine. Although I don't know yet if I'll have to change $PATH to $CLASSPATH hmmmm... for a later time
I then put
export CLASSPATH="/System/Library/
Frameworks/JavaVM.framework/Versions/1.3/Classes/classes.jar:/usr/local/
jakarta-tomcat-4.0.1/common/lib/servlet.jar"
into .bash_profile and now it works under bash as well. I had to join the lines together in vi due to the breaks.
I've finally got it compling without -classpath
Time for a pint
Hopefully that helps you out and you can get it running as well...
C'ya, Michael

Originally posted by Elton Hughes:
Hello Michael,
lol, I am glad it was you who responded. But, alas, I get the same freakin results! My new (thanks to you, and you were correct) classpath looks like this:
-> echo $CLASSPATH
/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Classes/classes.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/servlet.jar:/usr/local/jakarta-tomcat-4.1.27/common/lib/mail.jar:.
But I am still not able to compile a very very simple servlet.
Bloody heck! It is something that would drive a same man to drink!
So, I will relax for a wee bit and then try to look at the problem from a new angle.
But please, if you can think of something else, please let me know!
Elton

 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Michael,
Thank you for your help. Yes, I have it working now as well. I have also started using Ant to help in the process. That is one slick tool!
Take care,
Elton
p.s. I am now going to sit down to a pint of Bass. I think it is well deserved.
 
Is this the real life? Is this just fantasy? Is this a tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic