I have a server running rhel5 and jre 1.6. All my apps are running perfectly for now. But I want to install java 1.7 but keeping java 1.6 as the default so my running apps want be affected. If I want to install java 1.7 from a rpm how can I do this, and how can I run a my new app with the new version of java without changing default java version
Install the java versions you want, running applications should not be affected despite the default java version being changed.
Then run the
alternatives utility to pick your default java version:
alternatives --config java alternatives --config javac
Verify your setup with
java -version javac -version
If you're unsure, try this on a non-production host first.
To force tomcat to use a specific java version, no matter what the default,
setenv.sh in tomcat's
bin directory containing
First of all install Java 7/8 using:
sudo apt-get install openjdk-7-jdk
Then you need to update alternatives using:
sudo update-alternatives --config java
You will see:
There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1062 auto mode 1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1062 manual mode Press enter to keep the current choice[*], or type selection number:
Chose one that you need and type:
Then you can run your app on Java 7 and after that rollback it to 6 version.
first you need to make sure that your java apps are running thier java/javac from an absolute path. now the default java is the java you have when you execute:
# java -version
every java app you want to run must specify the absolute path according to your needs. to change the default execute:
# which java
and find out where is your default java bin is located and change the link to your designated jdk