码迷,mamicode.com
首页 > 编程语言 > 详细

java command not found

时间:2014-10-13 20:03:56      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:http   io   os   ar   java   for   sp   on   cti   

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

bubuko.com,布布扣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

bubuko.com,布布扣

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:

bubuko.com,布布扣

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

标签:http   io   os   ar   java   for   sp   on   cti   

原文地址:http://www.cnblogs.com/rojas/p/4022616.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!