JDK 安装
作者:互联网
Linux JDK安装
JDK.bin类型文件安装
- 百度云下载:jdk-6u45-linux-i586.bin
- 链接:https://pan.baidu.com/s/1ybPevZ88mnaFiAAKb94fSA
- 提取码:lum8
1、查看是否有执行权限,如果没有需要添加执行权限
ls -l jdk-6-dlj-linux-i586.bin
2、加入执行权限
chmod +x jdk-6-dlj-linux-i586.bin
3、执行JDK文件
./jdk-6-dlj-linux-i586.bin
4、将JDK文件移动到/usr/local/目录下
mv jdk1.6.0_45 /usr/local/
6、配置环境变量
vim /etc/profile
JAVA_HOME=/usr/local/jdk1.6.0_45/ JAVA_BIN=/usr/local/jdk1.6.0_45/bin JRE_HOME=/usr/local/jdk1.6.0_45/jre PATH=$PATH:/usr/local/jdk1.6.0_45/bin:/usr/local/jdk1.6.0_45/jre/bin CLASSPATH=/usr/local/jdk1.6.0_45/jre/lib:/usr/local/jdk1.6.0_45/lib:/usr/local/jdk1.6.0_45/jre/lib/charsets.jar export JAVA_HOME JAVA_BIN JRE_HOME PATH CLASSPATH
7、配置环境变量初始化
source /etc/profile
8、测试显示java环境
java -version
报错: Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object 解决: unpack200 /usr/local/jdk1.6.0_45/lib/tools.pack /usr/local/jdk1.6.0_45/lib/tools.jar unpack200 /usr/local/jdk1.6.0_45/jre/lib/rt.pack /usr/local/jdk1.6.0_45/jre/lib/rt.jar unpack200 /usr/local/jdk1.6.0_45/jre/lib/charsets.pack /usr/local/jdk1.6.0_45/jre/lib/charsets.jar报错:
JDK.gz压缩文件包安装
- 百度云下载:jdk-8u181-linux-x64.tar
- 链接:https://pan.baidu.com/s/1qKPSlWm-uD9N7gm_BwPicw
- 提取码:4pz2
1、解压 文件安装包
tar -zxvf jdk-8u181-linux-x64.tar.gz
2、将环境文件移动到目录下、命名为java
mv jdk1.8.0_181 /usr/java/
3、修改环境变量文件
vim /etc/profile
JAVA_HOME=/usr/java CLASSPATH=$JAVA_HOME/lib/ PATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME CLASSPATH
4、配置环境变量初始化
source /etc/profile
5、测试显示java环境
java -version
标签:java,lib,JDK,安装,45,jdk1.6,usr,local 来源: https://www.cnblogs.com/xiangsikai/p/12011414.html