Ubuntu11.04安装JDK7
第一步 下载
去下面的地址下载java7的开发包(或者去官方网站下载吧)
http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz
第二步 解压
sudo tar zxvf ./jdk-7-linux-i586.tar.gz -C /usr/lib/jvm cd /usr/lib/jvm sudo mv jdk1.7.0/ java-7-sun
第三步 修改环境变量
vim ~/.bashrc #加入以下内容 export JAVA_HOME=/usr/lib/jvm/java-7-sun export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH #保存后使之生效 source ~/.bashrc
第四步 配置默认程序
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-7-sun/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-7-sun/bin/javac 300 sudo update-alternatives --config java #如果你的系统中安装了其他的jdk,系统会提示出来,选择jdk7即可
最后 测试效果
minch@Minch-Ubuntu:/usr/lib/jvm$ java -version java version "1.7.0" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) Server VM (build 21.0-b17, mixed mode)
切记根据自己的机器的版本是64位还是32位来选择下载相应的文件来安装!!!
Ubuntu最好下载jdk-6u33-linux-x64.bin,不要下载rpm的版本:jdk-6u33-linux-i586-rpm.bin
.rpm.bin文件安装
需要先用alien转化
.rpm.bin文件安装
#先解压并且放置在安装的目录
chmod u+x jdk-6u33-linux-x64.bin
./jdk-6u33-linux-x64.bin
mv ./jdk1.6.0_33 /usr/local/
#设置环境便利(同上)
切记根据自己的机器的版本是64位还是32位来选择下载相应的文件来安装!!!
/install.sfx.25754: not found
lijg@lijg-virtualbox:~/Downloads$ ./jdk-6u33-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
./jdk-6u33-linux-i586-rpm.bin: 183: ./jdk-6u33-linux-i586-rpm.bin: ./install.sfx.25754: not found
Installing JavaDB
rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
error: open of sun-javadb-common-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-core-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-client-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-demo-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-docs-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-javadoc-10.6.2-1.1.i386.rpm failed: No such file or directory
参考:本文来源:http://minc.us/?p=271
Java
Java
Java
------
Java
Java
Java