Install JDK 7 In Ubuntu (with Clojure download)

Source: Internet
Author: User
First of all, I do have to say that there are many tutorials on installing JDK 7 on Ubuntu. However, most of them are binary files based on JDK 6. If you go to the Oracle official website, you will find that all files are compressed. tar.gz. In addition, this article also provides the download link for Clojure. If you have a file name, modify it based on your actual situation! & Mdash; & m

First of all, I do have to say that there are many tutorials on installing JDK 7 on Ubuntu. However, most of them are binary files based on JDK 6. If you go to the Oracle official website, you will find that all files are compressed. tar.gz.

In addition, this article also provides the download link for Clojure. If you have a file name, modify it based on your actual situation!

------------ Split line ------------

1. First, you need to download the latest JDK from the oracle official website. Go to the oracle official website and click Download.

Give a Web site: http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html

2. Transfer to the download folder and decompress the downloaded file. For example, the name of the downloaded file is jdk-7u7-linux-i586.tar.gz.

Cd xxx (your download path)

Sudo tar zxvf jdk-7u7-linux-i586.tar.gz

3. Copy the decompressed folder to/usr/lib/jdk. Assume that the decompressed folder is jdk1.7.0 _ 07.

Sudo cp-r jdk1.7.0 _ 07/usr/lib/jdk

NOTE: If/usr/lib/jdk does not exist, you can manually create one by yourself. The name can be jdk or jvm.

Sudo mkdir/usr/lib/jdk

4. Modify the environment variable, or use gedit as your

Vim ~ /. Bashrc

Add the following lines at the bottom. Note that the red part should be modified based on what you have downloaded and decompressed.

  1. Export JAVA_HOME =/usr/lib/jdk1.7.0 _ 07
  2. Export JRE_HOME =$ {JAVA_HOME}/jre
  3. Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib
  4. Export PATH =$ {JAVA_HOME}/bin: $ PATH

Save and exit. Enter:

Source ~ /. Bashrc

5. If your Ubuntu does not have jre installed by default (for example, I do not have jre installed in 10.10), you must first

Sudo apt-get install openjdk-6-jre-headless

Enter the following three lines to remind you that the red part should be modified as needed.

  1. Sudo update-alternatives -- install/usr/bin/java/usr/lib/jdk/jdk1.7.0 _ 07/bin/java 300
  2. Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jdk/jdk1.7.0 _ 07/bin/javac 300
  3. Sudo update-alternatives -- install/usr/bin/jar/usr/lib/jdk/jdk1.7.0 _ 07/bin/jar 300

6. Now it is complete, but you need to modify the default settings and enter

Sudo update-alternatives -- config java

Will let you choose 0, 1, 2..., the default value is 0, corresponding to openjdk, we need to change to the path we just set

/Usr/lib/jdk/jdk1.7.0 _ 07/bin/java 300 manual mode

Enter the corresponding serial number and press Enter.

You can enter

Java-version

Check the version number. It should be displayed.

  1. Java version "1.7.0 _ 07"
  2. Java (TM) SE Runtime Environment (build 1.7.0 _ 07-b10)
  3. Java HotSpot (TM) Server VM (build 23.3-b01, mixed mode)

------------ Split line ------------

Clojure: http://clojure.org/downloads

Download and decompress the package, enter the corresponding directory, enter,

Java-cp clojure-1.4.0.jar clojure. main

My version is 1.4.0. You can modify it as needed.

Then we will go to REPL. We should be familiar with Lisp kids shoes. After that, let's have fun.

Related Article

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.