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>

  • 相关阅读:
    oracle 数据量少 count(1)查询慢_很高兴!终于踩到了慢查询的坑
    C#中的委托(一)
    The hierarchy of the type is inconsistent
    errors exist in required project(s) xxx proceed with launch?
    oracle数据库常用操作语句 、创建视图
    hibernate.hbm.xml必须必须配置主键
    PWC6199:Generated servlet error:Only a type can be imported. org.apache.jasper.tagplugins.jstl.core.ForEach resolves to a package
    org.apache.jasper.JasperException: /WEB-INFO/jsp/product/edit.jsp(168,45)
    unique constraint(PD.HSI_RIGHT) violated
    svn报错:“Previous operation has not finished; run 'cleanup' if it was interrupted“
  • 原文地址:https://www.cnblogs.com/rojas/p/4022616.html
Copyright © 2011-2022 走看看