I installed two JAVA JREs on my new CentOS since Cassandra needs java7u25 or later while iReport needs to work with 1.6.Now how do I launch each program from command line telling each program which version to use?Do I have to change the /etc/profile file? If so how?
use different java version to run two programs
centos;java;jdk
There's no point in having them both in $PATH because only one will get used.  You could symlink one to a different name -- e.g. java6 -- I've never tried this w/ java and not sure if it would work.The best way to do this would be to install one of them (presumably 1.6) in a location like /opt/java6, leaving 1.7 as the default.  Then when you want to use 6:export PATH=/opt/java6/bin:$PATHAnd start it from the command line.  You could also put all that together in a script.  Don't try to run Cassandra from the same shell after that unless you remove that from $PATH (easy way to check is echo $PATH). To automate this for one specific application:#!/bin/shexport PATH=/opt/java6/bin:$PATHexec /path/to/applicationYou can then put that somewhere in the regular $PATH (e.g., /usr/local/bin), make sure it is executable (chmod 755 whatever.sh) and start the application that way.  It will then not affect $PATH in the process which launches it.