 |
 |
JAVA_HOME environment variable in jakarta
|
 |
|
 |
|
Junior Member
Join Date: May 2002
Location: Australia
Status:
Offline
|
|
I am trying to get tomcat and ant to run. Following a few different articles, that say I need to set the JAVA_HOME environment variable is defined correctly so I placed the folwing in my ~/.tcshrc file like following:-
# General settings for compiling programs
setenv CC cc
setenv CPPFLAGS -traditional-cpp
# Java on Mac OS X
setenv JAVA_HOME=/System/Library/Frameworks/JavaVM.framework
# Apache Jakarta Tomcat
setenv TOMCAT_HOME /usr/local/tomcat
alias tcu sudo ${TOMCAT_HOME}/bin/startup.sh
alias tcd sudo ${TOMCAT_HOME}/bin/shutdown.sh
# Apache Jakarta Ant
setenv ANT_HOME=/usr/local/ant
setenv PATH=${PATH}:${ANT_HOME}/bin
##
Yet I get the following message.
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
What is wrong, any help?
I already have ant and tomcat installed from binaries in /usr/local/ant and /usr/local/tomcat. Yet it seems that neither will run until some basic variables are set correctly.
How do I set these Java variables?
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Mar 2001
Status:
Offline
|
|
You are getting that message because you're pointing to the wrong location for JAVA_HOME. You need the directory corresponding to JAVA_HOME/bin/java, which is /usr.
I haven't set it up for a while, but to be sure of your setup you may want to read:
Apple's Tomcat info.
I hope this helps.
[ 05-23-2002: Message edited by: mmj_ngen ]
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
No NO NO!!!
On OS X, set JAVA_HOME to be /Library/Java/Home
make a file called:
~/Library/init/tcsh/environment.mine
and put in this line:
setenv JAVA_HOME /Library/Java/Home
save it, then close that terminal window and open a new one.
get rid of that .tcshrc and put it all in
~/Library/init/tcsh/
in environment.mine or aliases.mine !!!
[ 05-23-2002: Message edited by: Kristoff ]
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: May 2002
Location: Australia
Status:
Offline
|
|
why should I do this
______________________
get rid of that .tcshrc and put it all in
~/Library/init/tcsh/
in environment.mine or aliases.mine !!!
______________________
Why cannot I simple use .tcshrc file, as it seems to be the normal unix shell thing to do? Just a silly question.
Also thanks for your help it works now.
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Mar 2001
Status:
Offline
|
|
Kristoff, what's the benefit of using /Library/Java/Home vs /usr . I'm just curious. Apple's docs state /usr . I've used /usr in the past. Thanks for any infomation.
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Mar 2001
Status:
Offline
|
|
A little reading of recent posts of a few mailing lists showed that a lot of folks are using /System/Library/Frameworks/JavaVM.framework/Home as their JAVA_HOME.
I haven't done Java on Mac OSX for a while. Kristoff, I couldn't find any information about the path you specified. folks seem to be using either the one I posted previously or the one I posted this time.
The one you posted makes sense, but I was wondering how you came across it. It would be helpful for me in the future.
Thanks.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
Originally posted by dogwood:
<STRONG>why should I do this
______________________
get rid of that .tcshrc and put it all in
~/Library/init/tcsh/
in environment.mine or aliases.mine !!!
______________________
Why cannot I simple use .tcshrc file, as it seems to be the normal unix shell thing to do? Just a silly question.
Also thanks for your help it works now.</STRONG>
Well...shell configuration is arguably the most difficult thing.
I have already pontificated on this point before (search the forums).
Apple has opted to clean this up a bit.
Rather than having ~/.cshrc, ~/.tcshrc, etc/csh.cshrc, etc/.cshrc, etc/.tchsrc, etc, etc strewn about the OS...which leads to managability issues in multi-admin situations, they have opted for Global stuff to go in
/usr/share/init/tcsh/
and user specific stuff to go in
~/Library/init/tcsh/
For more info...read:
/usr/share/init/tcsh/README
But, disregard the first part (about 10 lines)...all the way until it says:
"In order to customize tcsh:" because it is hardcoded to use this configuration already.
This makes configuring the shell cleaner, and arguably easier than any other setup out there. Spread the word. Hardly anyone knows this, but it is a really nice feature.
Happy to help.
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
Originally posted by mmj_ngen:
<STRONG>Kristoff, what's the benefit of using /Library/Java/Home vs /usr . I'm just curious. Apple's docs state /usr . I've used /usr in the past. Thanks for any infomation.</STRONG>
Well, /Library/Java/Home is the Java Home!
The stuff in /usr is just wrapper scripts.
Actually, the whole JDK on OS X is rather...uh, contrived--for lack of a better word.
It works, and it's there, so that's all I care about. But, if you really look at the stuff here is what you have:
/usr contains a bunch of wrapper scripts that point to stuff in:
/System/Library/Frameworks/JavaVM.framework/Commands/
which is in turn a symlink to:
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands
noting that CurrentJDK is a symlink that points to:
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1
Then we have:
/Library/Java/Home is a symlink to:
/System/Library/Frameworks/JavaVM.framework/Home
which is in turn a symlink that points to:
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
which contains symlinks to stuff in:
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Commands
So essentially, I guess they do the same thing. I am not aware of Apple documentation that says to use /usr.
I have used /Library/Java/Home for as long as I can remember. I recall reading a tech note on the directory structure of OS X and it described the purpose of /Library. Remember that most end users can't "see" /usr, since it doesn't show up in the finder (by default). But everyone "sees" /Library/Java/Home.
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Mar 2001
Status:
Offline
|
|
Thanks for all the information. I guess I didn't expect there to be so many references to the same thing. It seems strange to me. I never navigated the links to find out where they went. I just never thought about it before now. It doesn't matter though. I think I'll switch to the path you specified. It makes sense.
The link that I posted earlier is Apple's documentation suggesting using the /usr directory for Tomcat.
Thanks again.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: May 2002
Status:
Offline
|
|
One other note worth mentioning. If you go & look in your listing of the .tcshrc file, you'll see that the JAVA_HOME & ANT_HOME variables are (I think) the only ones with incorrect (sh or bash) syntax.
The correct setenv format is
<font face = "courier">
setenv JAVA_HOME /wherever/it/should/be
setenv ANT_HOME /wherever/ant/is
</font>
Your .tcshrc file has
setenv JAVA_HOME=/whatever/you/had
and
setenv ANT_HOME=/whatever/you/had/for/ant
which has the effect of setting the variable JAVA_HOME=/whatever/you/had to be set with no value. (similarly for ANT_HOME)
That's why it tells you that JAVA_HOME is not defined -- it's not, this other thing is...
Replacing the = with space(s) should help. As to the appropriate locations, you can probably figure that out later once it agrees that the appropriate place is defined.
/nereus
[ 05-24-2002: Message edited by: nereus ]
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Feb 2002
Location: Scotland
Status:
Offline
|
|
I think a better and cleaner approach is to avoid setting system variables at all. Taking tomcat as an example I would create a shell script something like:
#!/bin/sh
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
export CATALINA_HOME=/usr/local/tomcat
$CATALINA_HOME/bin/startup.sh
set the executable bit on this script, put it somewhere in your path and you're ready to go.
Advantages of working this way are if you install a 2nd jdk for instance and want to run tomcat with that jdk, you can, without changing global system variables. If you want to try the latest build of tomcat, download it and change the CATALINA_HOME entry. Easy.
just my 2€.
Steven
|
|
what is a signature anyway?
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Kristoff:
<strong>Well...shell configuration is arguably the most difficult thing.
I have already pontificated on this point before (search the forums).
Apple has opted to clean this up a bit.
Rather than having ~/.cshrc, ~/.tcshrc, etc/csh.cshrc, etc/.cshrc, etc/.tchsrc, etc, etc strewn about the OS...which leads to managability issues in multi-admin situations, they have opted for Global stuff to go in
/usr/share/init/tcsh/
and user specific stuff to go in
~/Library/init/tcsh/
For more info...read:
/usr/share/init/tcsh/README
But, disregard the first part (about 10 lines)...all the way until it says:
"In order to customize tcsh:" because it is hardcoded to use this configuration already.
This makes configuring the shell cleaner, and arguably easier than any other setup out there. Spread the word. Hardly anyone knows this, but it is a really nice feature.
Happy to help.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Kristoff, I haven't heard any of your pontifications on this topic and when I did a search by your user number MacNN seemed to get you confused with [APi]TheMan and showed only his posts.
At any rate, I put my .cshrc file in ~/Library/init/tcsh/environment.mine and my environment variables work fine, but for some reason my prompt doesn't work. I had this line
set prompt = "[%m:%~] "
and my prompt is unchanged.
EDIT: Nevermind, I stuck the prompt line into rc.mine and it worked. I don't understand why it wouldn't work in environment.mine though, since it is sourced. But what is the purpose of path.mine? Can't that just go in environment.mine?
<small>[ 05-30-2002, 06:32 PM: Message edited by: absmiths ]</small>
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2002
Status:
Offline
|
|
absmiths,
Did you get your 'setenv PATH' statement to work in any of those files?
It only works for me if I enter it in the terminal.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by absmiths:
At any rate, I put my .cshrc file in ~/Library/init/tcsh/environment.mine and my environment variables work fine, but for some reason my prompt doesn't work. I had this line
set prompt = "[%m:%~] "
and my prompt is unchanged.
EDIT: Nevermind, I stuck the prompt line into rc.mine and it worked. I don't understand why it wouldn't work in environment.mine though, since it is sourced. But what is the purpose of path.mine? Can't that just go in environment.mine?[/QB]</font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">I put my prompt stuff in /usr/share/init/tcsh/tcsh.defaults
specificall, I have:
# Set up prompt
set promptchars = "%#"
if ("$version" =~ tcsh*) then
set prompt = "[%{\033[32m%}%m:%{\033[35m%}%c3%{\033[0m%}]%{\033[31m%} %n%{\033[0m%}%# "
else
if ($uid) then
set prompt = "[$host] $user% "
else
set prompt = "[$host] $user# "
endif
endif
set prompt2 = "%R -> " # if/while prompt
set prompt3 = "OK? %R? " # Spell correction prompt
on a black terminal window, I find this prompt visually appealing and quite useful.
This of course means that all users have this prompt.
But, it can be over-ridden in:
~/Library/init/tcsh/rc.mine
according to the file in /usr/share/init/tcsh/README
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by thesearcher:
<strong>absmiths,
Did you get your 'setenv PATH' statement to work in any of those files?
It only works for me if I enter it in the terminal.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">RTFM! <img border="0" title="" alt="[Wink]" src="wink.gif" />
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">
from /usr/share/init/tcsh/README:
<strong>
In order to customize tcsh:
mkdir ~/Library/init/tcsh
and create the following files there as necessary:
aliases.mine - shell aliases
completions.mine - completions
environment.mine - environment
rc.mine - run commands
path - command search path
</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">So, I would try setting that in a file called
~/Library/init/tcsh/path 
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2002
Status:
Offline
|
|
I've tried files named path and path.mine in both local and global locations, tried setting the executable bit, tried rebooting; all variations of the above are not recognized.
My path statement:
setenv PATH ${PATH}:${ANT_HOME}/bin:${TOMCAT_HOME}/bin
environment.mine:
# Java on Mac OS X
setenv JAVA_HOME /Library/Java/Home
# Apache Jakarta Tomcat
setenv TOMCAT_HOME /usr/local/jakarta-tomcat-4.0.3
setenv CATALINA_HOME ${TOMCAT_HOME}
alias tcu sudo ${TOMCAT_HOME}/bin/startup.sh
alias tcd sudo ${TOMCAT_HOME}/bin/shutdown.sh
# Apache Jakarta Ant
setenv ANT_HOME /usr/local/jakarta-ant-4.0.1
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by thesearcher:
<strong>I've tried files named path and path.mine in both local and global locations, tried setting the executable bit, tried rebooting; all variations of the above are not recognized.
My path statement:
setenv PATH ${PATH}:${ANT_HOME}/bin:${TOMCAT_HOME}/bin
</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Wrong syntax.
try making
~/Library/init/tcsh/path
set PATH=${PATH}:${ANT_HOME}/bin:${TOMCAT_HOME}/bin
|
|
signatures are a waste of bandwidth
especially ones with political tripe in them.
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|