zoukankan      html  css  js  c++  java
  • Linux 下安装JDK7

    1. 在32位ix86平台上用.tar.gz文件安装JDK7

      官方英文文档(http://docs.oracle.com/javase/7/docs/webnotes/install/linux/linux-jdk.html#install-32)

      

    Installation of the 32-bit JDK on Linux Platforms

    This procedure installs the Java Development Kit (JDK) for 32-bit Linux, using an archive binary file (.tar.gz).

    These instructions use the following file:

        jdk-7u<version>-linux-i586.tar.gz
    

    1. Download the file. Before the file can be downloaded, you must accept the license agreement. The archive binary can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location.

    2. Change directory to the location where you would like the JDK to be installed. Move the .tar.gz archive binary to the current directory.

    3. Unpack the tarball and install the JDK.

        % tar zxvf jdk-7u<version>-linux-i586.tar.gz
    

    The Java Development Kit files are installed in a directory called jdk1.7.0_<version> in the current directory.

    4. Delete the .tar.gz file if you want to save disk space.


    Installation of the 32-bit JDK on RPM-based Linux Platforms

    This procedure installs the Java Development Kit (JDK) for 32-bit RPM-based Linux platforms, such as Red Hat and SuSE, using an RPM binary file (.rpm) in the system location. You must be root to perform this installation.

    These instructions use the following file:

        jdk-7u<version>-linux-i586.rpm
    

    1. Download the file. Before the file can be downloaded, you must accept the license agreement.

    2. Become root by running su and entering the super-user password.

    3. Uninstall any earlier installations of the JDK packages.

        # rpm -e <package_name>
    

    4. Install the package.

        # rpm -ivh jdk-7u<version>-linux-i586.rpm
    

    To upgrade a package:

        # rpm -Uvh jdk-7u<version>-linux-i586.rpm
    

    5. Delete the .rpm file if you want to save disk space.

    6. Exit the root shell. No need to reboot.

    2.设置环境变量

    #vi /etc/profile

    在最后面加入

    #set java environment

    JAVA_HOME=/usr/java/jdk-1_5_0_02

    CLASSPATH=.:$JAVA_HOME/lib.tools.jar

    PATH=$JAVA_HOME/bin:$PATH

    export JAVA_HOME CLASSPATH PATH

    保存退出。

    要使JDK在所有的用户中使用,可以这样:

    vi /etc/profile.d/java.sh

    在新的java.sh中输入以下内容:

    #set java environment

    JAVA_HOME=/usr/java/jdk-1_5_0_02

    CLASSPATH=.:$JAVA_HOME/lib/tools.jar

    PATH=$JAVA_HOME/bin:$PATH

    export JAVA_HOME CLASSPATH PATH

    保存退出,然后给java.sh分配权限:chmod 755 /etc/profile.d/java.sh

    Linux安装JDK步骤3.在终端使用echo命令检查环境变量设置情况。

    #echo $JAVA_HOME

    #echo $CLASSPATH

    #echo $PATH

    4.检查JDK是否安装成功。

    #java -version

    如果看到JVM版本及相关信息,即安装成功!

      

  • 相关阅读:
    构造函数的继承
    创建一个不被销毁的空间 闭包小应用
    如何在Linux上恢复误删除的文件或目录
    一文详解 Ansible 自动化运维
    Shell 脚本编程最佳实践
    10 分钟看懂 Docker 和 K8S!
    BGP路由协议详解(完整版)
    浅析 Linux 中的零拷贝技术
    2020年DevOps工程师入门指南
    一条更新的SQL如何执行
  • 原文地址:https://www.cnblogs.com/xly1208/p/2890756.html
Copyright © 2011-2022 走看看