1
votes

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
Have you checked the various files, ~/.bashrc, ~/.bash_profile, /etc/bashrc etc? Maybe just grep "export JAVA_HOME" until you find where it's defined... - Mena
try adding export JAVA_HOME= in last line /etc/bash.bashrc - Ebrahimi
have you restarted the terminal? - Ash
This Q is not about programming as defined for StackOverflow. It may be more appropriate on the S.E. related site superuser.com. Consider using the flag link 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
@Mena grep shows exporting JAVA_HOME to usr/lib/jvm/java-1.8.0-openjdk-amd64 in .bashrc. But when I open .bashrc with gedit it is an empty file. - Vimbuddy

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