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

      

  • 相关阅读:
    微软同步框架入门之八使用WCF同步远程元数据
    使用Silverlight Toolkit TreeView树形控件
    使用Silverlight Toolkit绘制图表(上)柱状图
    Hello F#
    值类型和引用类型在hashtable里面性能比较分析1 GetHashCode()
    Fedora Core 6 完整下载信息
    IT从业者真的成了民工,悲哀呀
    俺也用一下mandriva,恩,KDE的效果的确不错
    我们的何时能赶上MS的脚步
    获得汉字字符串的首个拼音字母的缩写
  • 原文地址:https://www.cnblogs.com/xly1208/p/2890756.html
Copyright © 2011-2022 走看看