I have previously installed java 1.8.0 and the JAVA_HOME was set to usr/lib/jvm/java-1.8.0-openjdk-amd64. Now I uninstalled java and still the JAVA_HOME is set to the above path. I cleared it in etc/environment. But when i echo $JAVA_HOME it still shows the previous path. Even though I installed a new version of java and tried changing the JAVA_HOME it didn't work. Can anyone please help me?
1 Answers
3
votes
Simply spoken, there is a whole hierarchy of configuration files that might have been updated in the past and that contain that setup.
There could bee a local .profile, .bashrc; or system-wide pendants for you. So, depending on the shell you are using, the version of Linux, ... there are various places to look at. See here for some guidance with bash.
You can start with a simple
grep JAVA_HOME .*
in your home directory. Next level of "escalation":
/etc/environment, /etc/profile, /etc/profile.d/, /etc/bashrc
~/.bashrc,~/.bash_profile,/etc/bashrcetc? Maybe justgrep "export JAVA_HOME"until you find where it's defined... - Menaexport JAVA_HOME=in last line/etc/bash.bashrc- Ebrahimiflaglink at the bottom of your Q and ask the moderator to move it. Please don't post the same Q on 2 different sites. Please read stackoverflow.com/tour , stackoverflow.com/help/how-to-ask , stackoverflow.com/help/dont-ask , and stackoverflow.com/help/mcve before posting more Qs here. Thanks and Good luck. - shellter