> Why wouldn't this work?
> ~
[quoted text clipped - 4 lines]
> export JAVA_HOME
> echo $JAVA_HOME
[ snip ]
Executing a script in the normal way (./thescript, for example)
creates a subshell, and any environment variables you set are
set for the subshell -- and not passed back to the parent shell.
Hence your script has no effect on its caller's environment
variables.
To get the effect I think you want, you need to instead "source"
the script. If you're also using bash as your interactive
shell, you'd say
source ./thescript
or
. ./thescript

Signature
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.