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>

  • 相关阅读:
    How to Set Up an Rsync Daemon on Your Linux Server
    VMware workstation 设定开机引导等待时间
    Debian Buster Nginx 布署 Brophp 项目(类 Thinkphp)
    Laravel
    Debian 利用 iso 镜像完全离线更新 apt-cdrom
    Debian 采用 iso 镜像作为 apt 源
    Laravel中用GuzzleHttp
    Nginx详解(正向代理、反向代理、负载均衡原理)
    Debian Buster 配置 Laravel 运行环境(nginx + redis + supervisor)
    How to Install and Configure Bind 9 (DNS Server) on Ubuntu / Debian System
  • 原文地址:https://www.cnblogs.com/rojas/p/4022616.html
Copyright © 2011-2022 走看看