安装 Java 6

时间:2023-02-10 14:02:53
  1. 从服务器下载 Linux 64位 jdk 到本地。下载地址:\\192.167.100.225\share\Tool\JAVA\jdk-6u34-linux-x64.bin
  2. 给安装文件添加执行权限
    • $ chmod +x jdk-6u34-linux-x64.bin
  3. 安装 jdk
    • $ mkdir -p /opt/jdk6
      $ cp ./jdk-6u34-linux-x64.bin /opt/jdk6
      $ cd /opt/jdk6
      $ ./jdk-6u34-linux-x64.bin
  4. 修改环境变量
    • $ sudo vim /etc/environment
    • PATH 中加入 /opt/jdk6/jdk1.6.0_34/bin,新建 JAVA_HOME 和 CLASSPATH,例:
    • PATH="/opt/jdk6/jdk1.6.0_34/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
      JAVA_HOME=/opt/jdk6/jdk1.6.0_34
      CLASSPATH=.:/opt/jdk6/jdk1.6.0_34/lib