我已经通过以下命令安装了Java:
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
如果我理解正确,上面的命令将确保Java自动更新。我一直在成功使用Eclipse、STS和Tomcat,因此我相信Java已经正确安装了其环境。但我想知道java_home环境变量的位置。我尝试过:
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 emptygedit ~/.bashrc
and aftergedit .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.
GRADLE_HOME
变量包含在您的PATH
中之前,需要先设置它。 - tripleee