linux 环境变量参考地址(这里摘取部分信息):https://www.cnblogs.com/youyoui/p/10680329.html
环境变量可以简单的分成用户自定义的环境变量以及系统级别的环境变量。
用户级别环境变量定义文件:~/.bashrc、~/.profile(部分系统为:~/.bash_profile)
系统级别环境变量定义文件:/etc/bashrc、/etc/profile(部分系统为:/etc/bash_profile)、/etc/environment
另外在用户环境变量中,系统会首先读取~/.bash_profile(或者~/.profile)文件,如果没有该文件则读取~/.bash_login,根据这些文件中内容再去读取~/.bashrc。
Linux加载环境变量的顺序如下:
/etc/environment
/etc/profile
/etc/bash.bashrc
/etc/profile.d/test.sh
~/.profile
~/.bashrc
openjdk 安装文档参考地址(摘取部分信息):https://openjdk.org/install/
JDK 9 & Later
Oracle's OpenJDK JDK binaries for Windows, macOS, and Linux are available on release-specific pages of jdk.java.net as .tar.gz or .zip archives.
As an example, the archives for JDK 13 may be found on jdk.java.net/13 and may be extracted on the command line using
$ tar xvf openjdk-13*_bin.tar.gz
or
$ unzip openjdk-13*_bin.zip
depending on the archive type.
JDK 8
Debian, Ubuntu, etc.
On the command line, type:
$ sudo apt-get install openjdk-8-jre
The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.
Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
$ su -c "yum install java-1.8.0-openjdk"
The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.
cd /data/soft/
wget https://download.java.net/java/GA/jdk18.0.2.1/db379da656dc47308e138f21b33976fa/1/GPL/openjdk-18.0.2.1_linux-x64_bin.tar.gz
tar -xvf openjdk-18.0.2.1_linux-x64_bin.tar.gz
# 加入一下两行到最后
export JAVA_HOME="/data/soft/jdk-18.0.2.1/"
export PATH="$PATH:$JAVA_HOME/bin/"
source ~/.profile
java -version
javac -version
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。