linux_Ubuntu 12.04 安装jdk
1.下载jdk6
jdk6下载地址为:http://download.java.net/jdk6/,根据操作系统的选择对应的安装包,我的是ubuntu 12.04 32bit的,所以下载的文件是jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin,
2.在/usr/local下创建文件夹:
sudo mkdir java
cd /usr/local/java
将下载的jdk6的jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin文件copy到/usr/local/java目录下;
3.修改jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin文件的权限,让它可以运行:
sudo chmod u+x jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin
4.安装jdk6
./jdk-6u23-ea-bin-b03-linux-i586-18_oct_2010.bin
执行了此可执行程序后,其实就是把jdk6的包解压到当前目录而已;
5.修改环境变量
sudo vim /etc/environment
将里面的变量设置为:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/java/jdk1.6.0_38/bin"
CLASSPATH=.:/usr/local/java/jdk1.6.0_38/lib
JAVA_HOME=/usr/local/java/jdk1.6.0_38
保存退出。
配置profile:
sudo vim /etc/profile
在文件的末尾添加以下内容:
export JAVA_HOME=/usr/local/java/jdk1.6.0_38
export JRE_HOME=/usr/local/java/jdk1.6.0_38/jre
export PATH=$PATH:/usr/local/java/jdk1.6.0_38/bin
export CLASSPATH=./:/usr/local/java/jdk1.6.0_38/lib:/usr/local/java/jdk1.6.0_38/jre/lib
配置好了后,进行应用:
sudo source /etc/profile
安装 tomcat
mv tomcat6/ /usr/local/java/tomcat6
534 cd /usr/local/java/tomcat6/
535 ll
536 cd ..
537 ls
538 vi /etc/profile
539 source /etc/profile
其实最终添加的配置:
export CATAL_INA_HOME=/usr/local/java/tomcat6 #tomcat6
export JAVA_HOME=/usr/local/java/jdk1.6.0_45
export JRE_HOME=/usr/local/java/jdk1.6.0_45/jre
export PATH=$PATH:/usr/local/java/jdk1.6.0_45/bin
export CLASSPATH=./:/usr/local/java/jdk1.6.0_45/lib:/usr/local/java/jdk1.6.0_45/jre/lib
参考