本子

设置java环境
Linux 解压jdk包到/usr/lib目录下 tar -zxvf jdk-7u60-linux-x64.tar...
扫描右侧二维码阅读全文
06
2019/01

设置java环境

Linux

解压jdk包到/usr/lib目录下

tar -zxvf jdk-7u60-linux-x64.tar.gz -C /usr/lib

设置java环境

sudo vim /etc/profile.d/speechd-user-port.sh

末尾加入以下代码

export JAVA_HOME=/usr/lib/jdk1.7.0_60  
export JRE_HOME=${JAVA_HOME}/jre 
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH 

重启虚拟机

配置默认JDK版本

sudo update-alternatives --install /usr/bin/java java /usr/lib/jdk1.7.0_60/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jdk1.7.0_60/bin/javac 300
sudo update-alternatives --config java

测试

java -version 
(会显示如下信息,说明已配置成功)
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

Windows

JAVA_HOME  = 安装路径
path = %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; %JAVA_HOME%\bin
CLASSPATH = .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
Last modification:April 20th, 2019 at 11:35 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment