CentOS7.0安装JAVA环境

本人操作系统使用Fedora
16 x64,下载的Eclipse、JDK都是64位的。

CentOS7.0安装JAVA环境

安装JDK

 

 

1.配置JDK环境变量

 

把下载好的JDK(jdk-7u75-linux-x64.gz)文件上传到 Reg: /home/p2pweb/java/
目录下(目录可自定义)

 

[[email protected]
~]# tar -zxv -f jdk-7u75-linux-x64.gz // 解压压缩包

 

[[email protected]
~]# rm -rf jdk-7u75-linux-x64.gz // 删除压缩包

 

[[email protected]
~]# mv jdk1.7.0_75 jdk1.7 //重命名

 

在系统终端中输入:

 

1
[[email protected]
~]#vi /etc/profile

 

按“Page Down”文件翻到最后,在文档最后输入以下内容:1 export
JAVA_HOME=/home/p2pweb/java/jdk1.7.0_052 export
JAVA_BIN=/home/p2pweb/java/jdk1.7.0_05/bin3 export
PATH=$PATH:$JAVA_HOME/bin4 export
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar5 export
JAVA_HOME JAVA_BIN PATH
CLASSPATH执行如下命令让修改的profile文件立即生效1. /etc/profile注:. 和
/etc/profile 之间有空格

2验证是否安装成功

 

 

 

输入:java
-version[[email protected]
~]$java -versionjava version “1.7.0_75″Java(TM) SE Runtime Environment
(build 1.7.0_75-b13)Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04,
mixed
mode)[[澳门新葡亰赌995577,email protected]
~]$

如以上结果,输出版本信息,说明已安装成功。

 

 

安装Tomcat

 

 

 

1.把下载好的Tomcat(apache-tomcat-7.0.59.tar.gz)文件上传到 Reg:
/home/p2pweb/java/ 目录下(目录可自定义)

 

 

 

[[email protected]
~]#tar -zxv -f apache-tomcat-7.0.59.tar.gz //
解压压缩包[[email protected]
~]#rm -rf apache-tomcat-7.0.59.tar.gz//
删除压缩包[[email protected]
~]#mv apache-tomcat-7.0.59
tomcat72.启动Tomcat[[email protected]
~]$cd
/home/p2pweb/java/tomcat7/bin[[email protected]
bin]$lsbootstrap.jar daemon.sh startup.shcatalina.bat digest.bat
tomcat-juli.jarcatalina.sh digest.sh
tomcat-native.tar.gzcatalina-tasks.xml setclasspath.bat
tool-wrapper.batcommons-daemon.jar setclasspath.sh
tool-wrapper.shcommons-daemon-native.tar.gz shutdown.bat
version.batconfigtest.bat shutdown.sh version.shconfigtest.sh
startup.bat[[email protected]
bin]$./startup.shUsing CATALINA_BASE: /home/p2pweb/java/tomcat7Using
CATALINA_HOME: /home/p2pweb/java/tomcat7Using CATALINA_TMPDIR:
/home/p2pweb/java/tomcat7/tempUsing JRE_HOME:
/home/p2pweb/java/jdk1.7.0_75Using CLASSPATH:
/home/p2pweb/java/tomcat7/bin/bootstrap.jar:/home/p2pweb/java/tomcat7/bin/tomcat-juli.jarTomcat
started.如输出以上信息,说明Tomcat安装成功。

 

 

部署项目测试

 

在/home/p2pweb/java/tomcat7/webapps目下上传已经编译好的java项目就可以进行测试了。

http://www.bkjia.com/Linuxjc/970891.htmlwww.bkjia.comtruehttp://www.bkjia.com/Linuxjc/970891.htmlTechArticleCentOS7.0安装JAVA环境 安装JDK 1.配置JDK环境变量
把下载好的JDK(jdk-7u75-linux-x64.gz)文件上传到 Reg: /home/p2pweb/java/
目录下(目录可自定义) […

1、预备工作,下载jdk、tomcat、eclipse、tomcatplugin,下载地址如下:
eclipse-java-indigo-SR2-linux-gtk-x86_64.tar.gz
       
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR2/eclipse-java-indigo-SR2-linux-gtk-x86\_64.tar.gz&url=http://mirror.bit.edu.cn/eclipse/technology/epp/downloads/release/indigo/SR2/eclipse-java-indigo-SR2-linux-gtk-x86\_64.tar.gz&mirror\_id=1082
apache-tomcat-7.0.26.tar.gz
       
http://apache.etoak.com/tomcat/tomcat-7/v7.0.26/bin/apache-tomcat-7.0.26.tar.gz
tomcatPluginV33.zip
        http://www.eclipsetotale.com/tomcatPlugin/tomcatPluginV33.zip
jdk-7u3-linux-x64.tar.gz
       
http://download.[Oracle](http://www.linuxidc.com/topicnews.aspx?tid=12).com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz

2、解压eclipse-java-indigo-SR2-linux-gtk-x86_64.tar.gz、jdk-7u3-linux-x64.tar.gz、apache-tomcat-7.0.26.tar.gz到~/目录下
将tomcatPluginV33.zip解压在eclipse的plugins目录下

3、编辑~/.bashrc >
        CATALINA_HOME=/home/heroking/apache-tomcat-7.0.26
        CATALINA_BASE=/home/heroking/apache-tomcat-7.0.26
        CATALINA_TMPDIR=//home/heroking/apache-tomcat-7.0.26/temp
        JAVA_HOME=/home/heroking/jdk1.7.0_03
       
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
        PATH=$JAVA_HOME/bin:$CATALINA_HOME/bin:$PATH
        export JAVA_HOME CLASSPATH PATH
        export CATALINA_HOME CATALINA_BASE CATALINA_TMPDIR
<