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.
- Export JAVA_HOME =/usr/lib/jdk1.7.0 _ 07
- Export JRE_HOME =$ {JAVA_HOME}/jre
- Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib
- 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.
- Sudo update-alternatives -- install/usr/bin/java/usr/lib/jdk/jdk1.7.0 _ 07/bin/java 300
- Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jdk/jdk1.7.0 _ 07/bin/javac 300
- 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.
- Java version "1.7.0 _ 07"
- Java (TM) SE Runtime Environment (build 1.7.0 _ 07-b10)
- 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.