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>

java command not found的更多相关文章

  1. Drip is a launcher for the Java Virtual Machine that provides much faster startup times than the java command. The drip script is intended to be a drop-in replacement for the java command, only faster

    小结: 1.初始化jvm: 2.第一次唤醒java命令不快,后续快: https://github.com/elastic/logstash Advanced: Drip Launcher Drip  ...

  2. sudo: java: command not found

    背景:搭建了jumpserver,给开发划分了所有权限,但是开发那边账户不能执行java命令 报错:sudo: java: command not found 解决方法: 在用户管理权限配置sudoe ...

  3. Jenkins远程执行shell出现java: command not found

    之前在使用Jenkins执行远程shell脚本时,出现提示java: command not found:多方查找原因后发现是因为远程执行shell脚本时,不会自动加载环境变量,导致出现此错误,解决方 ...

  4. Wrapper: Error - Unable to execute Java command

    在64位的系统下 将短信程序运行于服务中,出现以下错误: Error: [size=14px; line-height: 26px;]FATAL  | wrapper  | 2012/06/18 17 ...

  5. Ubuntu 提示sudo: java: command not found解决办法

    ubuntu下运行sudo Java 时提示“sudo: java: command not found”.在网上找了,其中很多方法都提示要修改/etc/profile的配置,或是修改/etc/env ...

  6. kettle crontab java: command not found

    contos6.5下,单独执行脚本无问题,添加到crontab 里保存 java: command not found ※(重点)接着,编写执行kettle任务的shell脚本创建test.sh,将以 ...

  7. bash: java: command not found

    [root@izm5eab8t820b79js38tbxz ~]# java -version -bash: java: command not found 出现上面问题,解决方法: [root@iz ...

  8. java command line error opening registry key 'Software\JavaSoft\Java Runtime Environment' java.dll

    C:\Users\huxxxxchan>javaError: opening registry key 'Software\JavaSoft\Java Runtime Environment'E ...

  9. java 利用ManagementFactory获取jvm,os的一些信息--转

    原文地址:http://blog.csdn.net/dream_broken/article/details/49759043 想了解下某个Java项目的运行时jvm的情况,可以使用一些监控工具,比如 ...

随机推荐

  1. HNU 13108 Just Another Knapsack Problem DP + Trie树优化

    题意: 给你一个文本串,和一些模式串,每个模式串都有一个价值,让你选一些模式串来组成文本串,使获得的价值最大.每个模式串不止能用一次. 思路: 多重背包,枚举文本串的每个位置和模式串,把该模式串拼接在 ...

  2. hihocoder 1124 : 好矩阵 dp

    好矩阵 时间限制:3000ms 单点时限:1000ms 内存限制:256MB 描写叙述 给定n, m.一个n × m矩阵是好矩阵当且仅当它的每一个位置都是非负整数,且每行每列的和 ≤ 2.求好矩阵的个 ...

  3. [Angular] Configure an Angular App at Runtime

    It always again happens (especially in real world scenarios) that you need to configure your Angular ...

  4. 第九章 TCP和UDP同一时候用复用一个port实现一个回射server

    #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include &l ...

  5. 转:iPhone libxml2 not found during build

    在新建的一个项目中,出现编译错误,发现是缺少了libxml2.dylib,后面将这个资源包添加了,编译还是出现标题上所说的问题 #import <libxml/tree.h> //#imp ...

  6. 【HDU-4614】Vases and Flowers(线段树双查询)

    11946317 2014-10-23 09:08:28 Accepted 4614 437MS 2348K rid=11946317" target="_blank" ...

  7. 智课雅思短语---四、Exploit to the full one’s favorableconditions and avoid unfavorable ones

    智课雅思短语---四.Exploit to the full one’s favorableconditions and avoid unfavorable ones 一.总结 一句话总结:扬长避短 ...

  8. checkbox和文字不再同一水平线上

    为了演示效果,我故意将文字变为12px,将复选框变大,看到的效果就是下面的那样 然后,我们通过给复选框添加vertical-align:middle:让文字和复选框达到同一水平线的效果

  9. 使用 init-runonce脚本创建一个 openstack云项目

    source /etc/kolla/admin-openrc.sh cd /usr/share/kolla-ansible ./init-runonce 报错内容 Traceback (most re ...

  10. md5sum---文件校验和

    md5sum命令采用MD5报文摘要算法(128位)计算和检查文件的校验和.一般来说,安装了Linux后,就会有md5sum这个工具,直接在命令行终端直接运行. MD5算法常常被用来验证网络文件传输的完 ...