ubuntu配置java环境-包安装文件无需下载
2021-04-12 09:27
标签:复制 操作 链接 HERE 注意 src date csharp javac jdk文件下载 链接:https://pan.baidu.com/s/1GiNrIiVhIJzfTEIXtcEYuw 服务器新建jvm文件夹 把下载的压缩包放上传这里面进行解压 : tar -zxvf jdk-11.0.8_linux-x64_bin.tar.gz 修改环境变量 使环境变量马上生效 然后执行 若是初次安装jdk,会有下面的提示 There is only one alternative in link group java (providing /usr/bin/java): 否者,选择合适的jdk ubuntu配置java环境-包安装文件无需下载 标签:复制 操作 链接 HERE 注意 src date csharp javac 原文地址:https://www.cnblogs.com/beile/p/13355172.html
提取码:j6ad
复制这段内容后打开百度网盘手机App,操作更方便哦sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_60/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_60/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_60/bin/jar 300
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk1.7.0_60/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.7.0_60/bin/javap 300
sudo vim ~/.bashrc
在末尾追加以下内容#set oracle jdk environment
export JAVA_HOME=/usr/lib/jvm/jdk-11.0.8 ## 这里要注意目录要换成自己解压的jdk 目录
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source ~/.bashrc
设置系统默认jdk版本sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-11.0.8/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-11.0.8/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-11.0.8/bin/jar 300
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk-11.0.8/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk-11.0.8/bin/javap 300
sudo update-alternatives --config java
/usr/lib/jvm/jdk1.7.0_60/bin/java查看是否安装
java -version
文章标题:ubuntu配置java环境-包安装文件无需下载
文章链接:http://soscw.com/index.php/essay/74657.html