• ubuntu下命令行安装jdk --转载


    1.ubuntu使用的是openjdk,所以我们需要先找到合适的jdk版本。在命令行中输入命令:

    $apt-cache search openjdk

    返回结果列表(因个人电脑而有所不同):

    default-jdk-doc - Standard Java or Java compatible Development Kit (documentation) 
    …(省略部分显示结果) 
    openjdk-6-source - OpenJDK Development Kit (JDK) source files 
    openjdk-7-jre-dcevm - Alternative VM for OpenJDK 7 with enhanced class redefinition 
    openjdk-7-jre-lib - OpenJDK Java runtime (architecture independent libraries) 
    openjdk-7-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark 
    openjdk-8-dbg - Java runtime based on OpenJDK (debugging symbols) 
    openjdk-8-demo - Java runtime based on OpenJDK (demos and examples) 
    openjdk-8-doc - OpenJDK Development Kit (JDK) documentation 
    openjdk-8-jdk - OpenJDK Development Kit (JDK) 
    openjdk-8-jre - OpenJDK Java runtime, using Hotspot JIT 
    openjdk-8-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless) 
    openjdk-8-jre-jamvm - Alternative JVM for OpenJDK, using JamVM 
    openjdk-8-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark 
    openjdk-8-source - OpenJDK Development Kit (JDK) source files 
    uwsgi-app-integration-plugins - plugins for integration of uWSGI and application 
    uwsgi-plugin-jvm-openjdk-7 - Java plugin for uWSGI (OpenJDK 7)

    2.从搜索的列表里找到我们需要安装的jdk版本,如上面标黑的 
    openjdk-8-jdk - OpenJDK Development Kit (JDK)

    3.输入安装命令,进行安装:

    $sudo apt-get install openjdk-8-jdk

    等待命令行显示“done”,即安装成功过。

    4.查看安装结果。输入命令:

    $java -version

    显示结果如下: 
    openjdk version “1.8.0_91” 
    OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~15.10.1-b14) 
    OpenJDK Server VM (build 25.91-b14, mixed mode) 
    则说明安装成功。

    5.安装成功后,还需要配置java_home变量:

    1)输入命令:echo $java_home 
    返回空行;

    2)which javac 
    返回:/usr/bin/javac

    3)file /usr/bin/javac 
    返回:/usr/bin/javac: symbolic link to /etc/alternatives/javac

    4)file /etc/alternatives/javac 
    返回:/etc/alternatives/javac: symbolic link to /usr/lib/jvm/java-8-openjdk-i386/bin/javac

    5)file /usr/lib/jvm/java-8-openjdk-i386/bin/javac 
    返回:/usr/lib/jvm/java-8-openjdk-i386/bin/javac: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-Linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=a8eeb948df0418fc8f046910c73713f2b6697a9a, stripped

    6)sudo echo export JAVA_HOME=”/usr/lib/jvm/java-8-openjdk-i386/bin”>>~/.bashrc 
    输入密码;

    7)source ~/.bashrc

    8)测试命令:gedit ~/.bashrc 
    查看打开的文件末尾是否成功加入java_home

  • 相关阅读:
    从netty源码里拿到的关于http错误码,自己学习下
    9步搞定:用迅雷等工具下载百度网盘资源
    jstack定位cpu高占用
    solr学习笔记section2-solr单机(节点)简单的core操作
    solr学习笔记section1-在tomcat中部署单(节点)机solr5.5.4
    简单排序
    Thrift生成的bean对象,用java内省操作时注意(自己笔记)
    Netty方法误解ChannelHandlerContext.writeAndFlush(Object msg)
    腾讯笔试题,木棍组成多边形判断
    微软笔试题,luckstring
  • 原文地址:https://www.cnblogs.com/xiami-mj/p/6884663.html
Copyright © 2020-2023  润新知