Linux服务器安装JDK的步骤

Linux服务器安装JDK的步骤:

1.利用SSH工具上传下载好的JDK

cd D:\Program Files\SSH Communications Security\SSH Secure Shell

scp2.exe C:\Users\Administrator\Desktop\jdk-7u75-linux-x64.rpm [email protected]:/root

Are you sure you want to continue connecting (yes/no)? yes

[email protected]'s password:

2.在Linux端安装jdk

cd /root

chmod +x jdk-7u75-linux-x64.rpm

rpm -ivh jdk-7u75-linux-x64.rpm

3.配置环境变量,并验证是否安装成功

vi /etc/profile

JAVA_HOME=/usr/java/jdk1.7.0_75

CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar

PATH=$JAVA_HOME/bin:$PATH

export JAVA_HOME CLASSPATH PATH

编辑完成后记得输入:wq保存退出,最后一步就是通过source命令重新加载/etc/profile文件,使得修改后的内容在当前shell窗口有效:

source /etc/profile

java -version

javac -version

相关推荐