forked from johnwuossii/something
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86914dd
commit 9eba75f
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Step1.首先到Oracle官網上下載,最新版的"jdk-7u25-linux-x64.tar.gz" or "jdk-7u25-linux-i586.tar.gz" | ||
(事先建立一個Downloads的資料夾,下載的東西都可放這裡面集中。) | ||
|
||
Step2.將下載下來的JDK檔進行解壓縮,指令:tar -zxvf jdk-7u25-linux-i586.tar.gz | ||
|
||
Step3.複製解壓縮後的資料夾jdk_1.7.0_25,到/usr/lib/jdk/目錄下面,指令:cp -r ~/Downloads/jdk1.7.0_25/ /usr/lib/jdk/ | ||
(這裡如果沒有jdk資料夾,則建立該資料夾,指令:sudo mkdir /usr/lib/jdk) | ||
|
||
Step4.設置環境變數,打開文件/etc/profile,指令:sudo vi /etc/profile | ||
|
||
Step5. | ||
在文件的最後端加上: | ||
export JAVA_HOME=/usr/lib/jdk/jdk1.7.0_25 | ||
export JRE_HOME=/usr/lib/jdk/jdk1.7.0_25/jre | ||
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH | ||
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib | ||
|
||
Step6.將系統默認的jdk修改過來,也就是java和javac指令由系統自帶的換成你自己安裝的 | ||
|
||
指令: | ||
sudo update-alternatives --install /usr/bin/java java /usr/lib/jdk1.7.0_25/bin/java 300 | ||
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jdk1.7.0_25/bin/javac 300 | ||
sudo update-alternatives --config java | ||
sudo update-alternatives --config javac | ||
|
||
Step7.檢查版本,指令:java -version | ||
如果出現以下字樣,代表順利完成安裝。 | ||
|
||
java version "1.7.0_25" | ||
Java(TM) SE Runtime Environment (build 1.7.0_25-b15) | ||
Java HotSpot(TM) Server VM (build 23.25-b01, mixed mode) |