简体   繁体   中英

Not able to set JAVA_HOME

I have 3 installed versions of java (1.6,1.7,1.8) in my machine. Java alternatives has been configured to Java 1.8. So whenever i type java -version it is picking up from alternatives and showing java 1.8 .

Here now i want to use other version of java (1.6 or 1.7) , for that i have tried updating the .bashrc with other java paths. But still it is showing alternatives version (1.8)

在此处输入图片说明

Is there any way to override alternatives java from user level.

Here is a blogpost explaining how to change jdk version in a *nix environment from terminal:

https://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/

There is no need to change your environment to switch Java version.

You can simply qualify the version you want to use. Alternatively, just make sure the version you want is first on the PATH, not last.

See my old answer for examples. It's for Windows, but it should work similarly for Linux.
https://stackoverflow.com/a/32365879/5221149

Found the fix

I did like below

export PATH:new_java_path:$PATH . Now it started working for the current session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM