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版本及相关信息,即安装成功!

      

  • 相关阅读:
    Apache的Order Allow,Deny 详解
    apache的AllowOverride以及Options使用详解
    安装启动apache2.4后报Invalid command 'order', perhaps misspelled or defined by a module not included
    前端常见跨域解决方案(全)
    php面试宝典
    php面试题2018
    nginx负载均衡的5种策略
    多台服务器共享session问题
    小程序定义并使用类
    微信小程序真机预览接口不到数据,打开调试确能请求到
  • 原文地址:https://www.cnblogs.com/xly1208/p/2890756.html
Copyright © 2011-2022 走看看