Here is my system info
wangbo@ubuntu:~$ uname -a
Linux ubuntu 4.4.0-72-generic #93-Ubuntu SMP Fri Mar 31 14:07:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
When I check java version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
but when I echo $JAVA_HOME
/usr/lib/jvm/java-9-oracle
It is unmatched , It seems that I defined $JAVA_HOME somewhere , but I can`t found it , Anyone can help me how can I found my $JAVA_HOME defined
Other useful info :
UPDATE
wangbo@ubuntu:~$ more /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
1) JAVA_HOME
is most probably defined in /etc/profile.d/jdk.sh
and /etc/profile.d/jdk.csh
These files are unfortunately not managed by the update-alternatives
system.
2) Which executable you run should depend on the update-alternatives
system, but if you have forced a particular version in your PATH
it won’t.
Many java applications are actually invoked by scripts which choose their preferred jvm setting up a consistent environment, and shouldn’t be affected by your problem. It is best to have a consistent environment for free java invocations from the shell, however, and in most installations I know this is achieved manually...
Some java distributions don’t need JAVA_HOME at all. In other cases you need it. My advice is to define JAVA_HOME only when it turns out you need it. If it is the case, define it in a shell script and use that script to invoke the commands that you need that particular value for.
EDIT: /etc/profile.d/jdk.sh
seems to be installed by oracle-java8-set-default
.
# Uninstall the package (choose one)
sudo apt purge oracle-java8-set-default
sudo apt remove --purge oracle-java8-set-default
# Configure the desired Java binary
sudo update-alternatives --config java
sudo update-alternatives --config javac
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With