File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Mac OS and the fly likes is there something wrong with my classpath? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "is there something wrong with my classpath?" Watch "is there something wrong with my classpath?" New topic
Author

is there something wrong with my classpath?

michael bradly
Ranch Hand

Joined: Oct 06, 2000
Posts: 112
What am I missing? I've made many modifications and am still unable to have my classpath respond as I'd like it to. I'm wondering if there is something small that I am not grasping here. I am unable to compile servlets and I am unable to start tomcat with my present settings. Although I can compile servlets if I javac -classpath /usr/local/etc... file.java and I can start tomcat by export JAVA_HOME=/usr then start it up.
Here is my classpath
PATH=JAVA_HOME=/usr:CATALINA_OPTS=-Dfile.encoding=ISO-8859-1:/Users/newuser/dev/apache-ant-1.5.3-1/bin:
/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Classes/classes.jar:
/usr/local/jakarta-tomcat-4.1.18/common/lib/servlet.jar:
/usr/local/mysql/mysql-jdbc/jdbc-driver/mysql-connector-java-3.0.8-stable-bin.jar:
/usr/local/mysql/bin:/bin:/sbin:/usr/bin:/usr/sbin
Thanks, Michael
[ Jess broke up the classpath so the page wouldn't have a huge horizontal scroll bar ]
[ November 27, 2003: Message edited by: Jessica Sant ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

You should not need to make any changes to your classpath to run Tomcat. The startup scripts will handle all of that as long as you've defined the JAVA_HOME env variable as appropriate (/Library/Java/Home for me).
With regards to compiling, you need to make sure that servlet.jar is in the compiler's classpath. That file can usually be found in $CATALINA_HOME/common/lib.
Aside: one of the biggest favors you can do yourself is to use Ant as your build tool. It runs flawlessly under OS X.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
michael bradly
Ranch Hand

Joined: Oct 06, 2000
Posts: 112
I'll check to see if I have the servlet.jar correctly placed in CATALINA_HOME.
As far as ANT goes, that's next on my learning list. I'm definately seeing the benefits of using it. Although, I'm hearing good things about MAVEN...
Thanks for you help,
Michael
Originally posted by Bear Bibeault:
You should not need to make any changes to your classpath to run Tomcat. The startup scripts will handle all of that as long as you've defined the JAVA_HOME env variable as appropriate (/Library/Java/Home for me).
With regards to compiling, you need to make sure that servlet.jar is in the compiler's classpath. That file can usually be found in $CATALINA_HOME/common/lib.
Aside: one of the biggest favors you can do yourself is to use Ant as your build tool. It runs flawlessly under OS X.
bear
Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
Hi,
I would recommend checking out this site:
http://developer.apple.com/internet/java/tomcat1.html
I have installed tomcat on two Macs, running 10.2.8 and 10.3.1. Everything works as it should.
Elton
michael bradly
Ranch Hand

Joined: Oct 06, 2000
Posts: 112
I followed that page on my installation. Everything works fine, however I couldn't resolve compiling a servlet without typing in
javac -classpath /usr/local/jakart-tomcat-4.1.18/common/lib/servlet.jar fileName, even though I had it in my classpath.
I had the same issue with JAVA_HOME. It's in my classpath, but tomcat won't start unless I type in $export JAVA_HOME=/usr
I was curious if I was missing something since I was getting tired of typing that in all the time.
Thanks, Michael

Originally posted by Elton Hughes:
Hi,
I would recommend checking out this site:
http://developer.apple.com/internet/java/tomcat1.html
I have installed tomcat on two Macs, running 10.2.8 and 10.3.1. Everything works as it should.
Elton
Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
Hi Michael,
Just out of curiousity, what shell are you using?
I am using bash and this is what is in my .bash_profile

To start up tomcat, I just use a simple little script

I hope that helps.
Elton
Elton Hughes
Ranch Hand

Joined: Jun 19, 2003
Posts: 72
Hi Michael,
Now I am not so sure about my help.
I just tried to compile a test servlet on my home computer, and it did not work.
Lets go back to the basics. My home configuration is:
PowerBook G4 667
512 meg RAM
MacOS 10.3.1 clean install
I downloaded Tomact 4.1.27 and installed it per the earlier mentioned article.
Tomcat does load. The index page does appear. But when I try to compile a servlet, I get this error:

Not what I get when I compile at work. Yet the two installations are nearly identical. The only difference I can (currently) think of is at work I did an 'archive and install', while at home it was an 'erase and install' upgrade. Hmm, maybe something, maybe nothing.
Anyway, that is a start. I hope we can solve this problem. I want to use my home system as a test machine.
Elton
michael bradly
Ranch Hand

Joined: Oct 06, 2000
Posts: 112
I've been playing around with tcsh since I've never used it before as well as using bash on occasion, but I think I'm done experimenting and am sticking with bash.
Additionally I never did create that script as they instructed on the developer page. I guess I should have made life simpler by doing it the first timt I went through that page.
Lastly, I had a friend give me a good lecture on classpath issues which definately clarified some of my rambling thoughts. I guess its time to set up my installation box because I've forgotten so much about linux/unix.
Thanks,
Michael

Originally posted by Elton Hughes:
Hi Michael,
Just out of curiousity, what shell are you using?
I am using bash and this is what is in my .bash_profile

To start up tomcat, I just use a simple little script

I hope that helps.
Elton
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is there something wrong with my classpath?