Java入门基础:linux centos下安装和配置jdk8
1、下载JDK8
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2、使用FileZilla将文件上传到服务器:
3、解压安装包
tar -zxvf jdk-8u231-linux-arm64-vfp-hflt.tar.gz
4、创建文件夹:
mkdir /usr/local/java
5、将解压的Java安装程序复制到文件夹中
mv jdk1.8.0_231/* /usr/local/java
6、打开/etc/profile配置文件
vi /etc/profile
加入如下配置内容
export JAVA_HOME=/usr/local/java
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
7、使配置文件生效
source /etc/profile
8、执行java命令验证是否安装成功:
[[email protected] java]# java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server,
because you are running on a server-class machine.