I have installed java by these commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo update-java-alternatives -s java-7-oracle
If I understood properly these commands above garantee that java will update automatically. I have been using Eclipse, STS and Tomcat successfully, then I believe that java is properly installed with its environments.
But I want to know where is the java_home environment. I tried:
gedit /etc/environment
I found:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$GRADLE_HOME/bin"
GRADLE_HOME="/opt/gradle/gradle-1.6"
whereis java
(I believe that this is just a file find)
java: /usr/bin/java /usr/bin/X11/java /usr/share/java /usr/share/man/man1/java.1.gz
gedit ~/.pam_environment
But it is completely empty
gedit ~/.bashrc
and after gedit .profile
(I believe that this is just script files that run while starting linux). But I didn't find any string with "java".
printenv JAVA_HOME
(I believe that this only prints variables set by export and it is valid only for the exact session you set) But nothing has printed.
I am new to Linux. Could someone help me find where is the java environment in my system and please adjust any wrong believes I wrote before?
You can use
grep JAVA_HOME /etc/environment /etc/bash.bashrc /etc/profile.d/* /etc/profile
In my case after installing java from webupd8team ppa in Ubuntu 18.04 the scripts with setting and exporting JAVA_HOME variable are located in
/etc/profile.d/jdk.csh:setenv JAVA_HOME /usr/lib/jvm/java-8-oracle
/etc/profile.d/jdk.sh:export JAVA_HOME=/usr/lib/jvm/java-8-oracle