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>

最新文章

  1. java环境配置为1.7jdk为什么cmd java -version查看版本是1.8
  2. string to char* and char* to string 玩转 String 和 Char*
  3. C++做client Java做客户端传送数据
  4. openlayers加载百度地图
  5. errorPlacement的位置问题
  6. BZOJ 1609: [Usaco2008 Feb]Eating Together麻烦的聚餐( LIS )
  7. JavaSE(一) IO类层次关系和各种IO流的用法总结
  8. git for windows+TortoiseGit客户端的使用二
  9. ArcGIS API for JavaScript 4.2学习笔记[29] 热点(密度)分析——以报警频率为例【使用Geoprocessor类】
  10. pmi-ACP考试知识点梳理(部分)
  11. C# 多线程学习笔记 - 2
  12. linux ps top 命令 VSZ,RSS,TTY,STAT, VIRT,RES,SHR,DATA的含义
  13. autotools源文件相同/不同目录下
  14. linux_修改文件权限chmod 、改变文件/目录所有者chown
  15. OpenFeign封装为springboot starter
  16. AE IRasterCursor 获取栅格图层像素值
  17. 《FPGA全程进阶---实战演练》第三章之PCB设计之去耦电容
  18. redis实现自动输入完成(八)
  19. redis使用入门
  20. /proc/meminfo详解

热门文章

  1. 【Henu ACM Round#24 A】k-String
  2. 国庆 day 2 下午
  3. hadoop-05-mysql修改密码
  4. 【JS】怎样用原生JS实现jQuery的ready方法
  5. IPS
  6. GridView 绑定 ObjectDataSource
  7. ItemTouchHelper(实现RecyclerView上添加拖动排序与滑动删除的所有事情)
  8. UVa 140 Bandwidth【枚举排列】
  9. 515Nod 1126 求递推序列的第n项【矩阵快速幂】
  10. bzoj 2456: mode 思维题 好题