This question already has an answer here:
My college currently uses a very old (like 3 years old) openJDK 1.7 distribution. And being a student, obviously I don't have root privileges. I wanted to use a much later version downloaded a much more recent version from their official website since one of my app (solr) requires it.
I downloaded the JRE 1.8 and checked the interpreter using
saikrishnac@chervil:~/jre18/bin$ ./java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) saikrishnac@chervil:~/jre18/bin$
It turned out to be just as expected. Now I want to direct all the java calls made by the app to this bin. But, by default, this is what the university has running
saikrishnac@chervil:~$ java -version java version "1.7.0_91" OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-1~deb8u1) OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode) saikrishnac@chervil:~$
So, I'm guessing I need to change the
JAVA_PATH variable in
/etc/profie. But I've only read only access and hence I cannot add the following.
export JAVA_HOME="path" export PATH=$JAVA_HOME/bin:$PATH
The above was suggested at: https://stackoverflow.com/questions/24641536/how-to-set-java-home-in-linux-for-all-users
So, is there any workaround for changing the path for just my user account. I mean, when i run java in my account I wish it executed with the jre18 binary.