ubantu安装java

环境ubantu

下载jdk1.7 64位http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk7-downloads-1880260.html

paohaijiao@ubuntu :~$ uname -a
Linux ubuntu 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

paohaijiao@ubuntu :~$ java -verison
The program 'java' can be found in the following packages:
 * gcj-4.4-jre-headless
 * gcj-4.6-jre-headless
 * openjdk-6-jre-headless
 * gcj-4.5-jre-headless
 * openjdk-7-jre-headless
Try: sudo apt-get install <selected package>
paohaijiao@ubuntu :~$

paohaijiao@ubuntu :~$ sudo  mkdir /usr/java
[sudo] password for paohaijiao:

2.开启ssh服务

sudo apt-get install openssh-server

paohaijiao@ubuntu :~/Desktop$ ls
jdk-7u79-linux-x64.tar.gz
paohaijiao@ubuntu:~/Desktop$ sudo mv jdk-7u79-linux-x64.tar.gz /usr/java  
paohaijiao@ubuntu:~/Desktop$ cd /usr/java  
paohaijiao@ubuntu:/usr/java$ ls
jdk-7u79-linux-x64.tar.gz

paohaijiao@ubuntu:/usr/java$ sudo tar -zxvf jdk-7u79-linux-x64.tar.gz

paohaijiao@ubuntu:/usr/java$ sudo rm jdk-7u79-linux-x64.tar.gz
paohaijiao@ubuntu:/usr/java$ ls
jdk1.7.0_79
paohaijiao@ubuntu:/usr/java$ cd jdk1.7.0_79

sudo vim /etc/profile

export JAVA_HOME=/usr/java/jdk1.7.0_79
    export JRE_HOME=/usr/java/jdk1.7.0_79/jre  
    exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib  
    export PATH=$PATH:$JAVA_HOME/bin 
source /etc/profile

paohaijiao@ubuntu:/usr/java/jdk1.7.0_79$ java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)



你可能感兴趣的:(ubantu安装java)