java Command not found

Source: Internet
Author: User

Installation PROCEDURE on RASPBERRY PI

The remaining steps should is performed directly on the console of the Raspberry Pi or using a SSH terminal connection wit  H Shell access.  In the last step, we transfered the Oracle JDK file to the "PI" user ' s home directory. We should is logged in as the "PI" user and already in the user ' s home directory.

Lets Create a new directory where we'll 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 would 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 di Rectory.

With the unpack complete it now time-to-move the new unpacked directory to the Java install location that we created Earl Ier 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 the system know there are 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, we want this JDK to is the default Java runtime for the system. The following command would 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 a ready for use.

ADD java_home Environment VARIABLE

Some Java programs require a java_home environment variable to being 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 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.