zoukankan      html  css  js  c++  java
  • java command not found

    INSTALLATION PROCEDURE ON RASPBERRY PI

    The remaining steps should be performed directly on the console of the Raspberry Pi or using a SSH terminal connection with shell access.  In the last step, we transfered the Oracle JDK file to the "pi" user's home directory.  We should be logged in as the "pi" user and already in the user's home directory.

    Lets create a new directory where we will install the JDK files to. 

    sudo mkdir -p -v /opt/java

    Next, lets unpack the Oracle JDK .gz file using this command

    tar xvzf ~/jdk-7u10-linux-arm-sfp.gz

    The unpacking process will take a few seconds to complete.  It unpacks all the contents of the Oracle JDK tz file to a new directory named "jdk1.7.0_10" located in the user's home directory.

    With the unpack complete its now time to move the new unpacked directory to the Java install location that we created earlier under "opt/java".  

    sudo mv -v ~/jdk1.7.0_10 /opt/java

    We can also delete the original .tz file as it is no longer needed 

    rm ~/jdk-7u10-linux-arm-sfp.gz

    To complete the JDK installation we need to let the system know there is a new JVM installed and where it is located.  Use the following command to perform this task.

    sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.7.0_10/bin/java" 1

    And finally we also need to tell the system that we want this JDK to be the default Java runtime for the system. The following command will perform this action.

    sudo update-alternatives --set java /opt/java/jdk1.7.0_10/bin/java

    Now java is installed.  To test and verify we can execute the java command using the version argument.

    java -version

    You should get the following response:

    That's it the Oracle JDK is installed and ready for use.

    ADD JAVA_HOME ENVIRONMENT VARIABLE

    Some Java programs require a JAVA_HOME environment variable to be configured on the system.  Add the following line to you "/etc/environment" using your favorite text editor.

    JAVA_HOME="/opt/java/jdk1.7.0_10"


    Also, edit your "~/.bashrc" file using this command

    nano ~/.bashrc

    and add the following two lines to the bottom of the file and save.

    export JAVA_HOME="/opt/java/jdk1.7.0_10"
    export PATH=$PATH:$JAVA_HOME/bin 


    Reboot or re-login to apply the export to your environment.  

    ------------------------------------------------------------------------

    att:

    sudo update-alternatives --install "/usr/bin/java" "java" "/opt/javak1.7.0_10/bin/java" 1

                  --install <link> <name> <path> <priority>

  • 相关阅读:
    centos7 做rails 执行rails server 报错
    centos 7 安装 rvm 超时
    centos7 打造基于python语言Selenium2自动化开发环境
    RubyMine8 安装
    linux 下安装 RZ SZ命令 以及使用
    centos 7.2 安装mysql 修改 初始密码
    win10系统配置FTP
    Windows环境安装MySQL8.0.11
    IntelliJ IDEA 2017 上传本地项目至码云
    IntelliJ IDEA 2017.3 搭建一个多模块的springboot项目(三)
  • 原文地址:https://www.cnblogs.com/rojas/p/4022616.html
Copyright © 2011-2022 走看看