File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Multiple Java Enviroment on Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Multiple Java Enviroment on Linux" Watch "Multiple Java Enviroment on Linux" New topic

Multiple Java Enviroment on Linux

Kevin Fonner

Joined: Sep 20, 2001
Posts: 21
On my windows system I use batch files to setup different paths to use different jre's and jdk's. I set up a script on Linux but it doesn't seem to be adjusting my path. Does anybody know how to do this.
Here is my
# Set Java Enviroment
export JAVA_HOME
export JDK_HOME
# Set Path
export PATH
Varun Narula
Ranch Hand

Joined: Nov 19, 2001
Posts: 90
maybe you need to add the classpath variables too. the classpath currently has been set only for the current directory(.)
try adding $JAVA_HOME/jre/lib/rt.jar and tools.jar to your classpath
Hope that helps !
Varun Narula

There are only 10 types of people in this world; those who understand binary and those who dont<p>Varun Narula <br />SCJP, SCWCD, IBM-486 (UML)
Steve Deadsea
Ranch Hand

Joined: Dec 03, 2001
Posts: 125
The only thing I can think of is to add quotes:
export PATH
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Hi - If you are invoking the script like: # it is in PATH
./ # it is not in PATH
then the shell forks and execs a new shell to run the script, which ends, and you are right back to where you started.
To properly set environment variables for the running shell, do:
. ./
HTH, Guy
I agree. Here's the link:
subject: Multiple Java Enviroment on Linux
It's not a secret anymore!