由于找不到系统自带的jdk的目录而且系统里遍布都是分不清,而且自带的是OpenJdk不太试用搭建的项目所以欲将其删除。
(一)卸载步骤:
1、查找
rpm -qa | grep jdk
rpm -qa | grep gcj
2、删除:
例如:rpm -e --nodeps java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
类似上面删除所列软件;
(二)安装
1、 Jdk
Jdk1.7*版本以上的貌似不必配置java环境就可以(我还是又配置了一下
vi /etc/profile 在其中添加些配置信息,之后执行 source /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
否则echo $JAVA_HOME)看不到结果。而且Tomcat7也是如此,解压后(一般放在 /usr/local/ 下)
然后执行sh /usr/local/tomcat7/bin/startup.sh 系统就自动配置了
然后直接检测:
(一般最好自己再在/etc/profile里添加上Tomcat的配置)。
在/etc.profile文件最后添加上
-
export TOMCAT_HOME=/usr/local/tomcat7
-
export CATALINA_HOME=/usr/local/tomcat7
-
export CATALINA_BASE=/usr/local/tomcat7
对于如果出现这样的错误提示:
-
[root@root tomcat7]# ./bin/startup.sh
-
Using CATALINA_BASE: /usr/local/tomcat7
-
Using CATALINA_HOME: /usr/local/tomcat7
-
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
-
Using JRE_HOME: /usr/java/jdk1.7.0_79/jre
-
Using CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
-
Tomcat started.
-
[root@root tomcat7]# ./bin/c
-
catalina.sh configtest.sh
-
[root@root tomcat7]# ./bin/catalina.sh run
-
Using CATALINA_BASE: /usr/local/tomcat7
-
Using CATALINA_HOME: /usr/local/tomcat7
-
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
-
Using JRE_HOME: /usr/java/jdk1.7.0_79/jre
-
Using CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Server version: Apache Tomcat/7.0.61
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Server built: Mar 27 2015 12:03:56 UTC
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Server number: 7.0.61.0
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: OS Name: Linux
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: OS Version: 2.6.32-220.el6.i686
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Architecture: i386
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Java Home: /usr/java/jdk1.7.0_79/jre
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: JVM Version: 1.7.0_79-b15
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: JVM Vendor: Oracle Corporation
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: CATALINA_BASE: /usr/local/tomcat7
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: CATALINA_HOME: /usr/local/tomcat7
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat7/conf/logging.properties
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Command line argument: -Djava.endorsed.dirs=/usr/local/tomcat7/endorsed
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Command line argument: -Dcatalina.base=/usr/local/tomcat7
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Command line argument: -Dcatalina.home=/usr/local/tomcat7
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.startup.VersionLoggerListener log
-
信息: Command line argument: -Djava.io.tmpdir=/usr/local/tomcat7/temp
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
-
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/i386:/lib:/usr/lib
-
五月 04, 2015 4:54:02 上午 org.apache.coyote.AbstractProtocol init
-
信息: Initializing ProtocolHandler ["http-bio-80"]
-
五月 04, 2015 4:54:02 上午 org.apache.coyote.AbstractProtocol init
-
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
-
五月 04, 2015 4:54:02 上午 org.apache.coyote.AbstractProtocol init
-
严重: Failed to initialize end point associated with ProtocolHandler ["ajp-bio-8009"]
-
java.net.BindException: 地址已在使用 <null>:8009
-
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:413)
-
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:649)
-
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
-
at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
-
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
-
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
-
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
-
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:821)
-
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
-
at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
-
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
-
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
-
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
-
at java.lang.reflect.Method.invoke(Method.java:606)
-
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
-
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
-
Caused by: java.net.BindException: 地址已在使用
-
at java.net.PlainSocketImpl.socketBind(Native Method)
-
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
-
at java.net.ServerSocket.bind(ServerSocket.java:376)
-
at java.net.ServerSocket.<init>(ServerSocket.java:237)
-
at java.net.ServerSocket.<init>(ServerSocket.java:181)
-
at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
-
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:400)
-
... 16 more
-
-
五月 04, 2015 4:54:02 上午 org.apache.catalina.core.StandardService initInternal
-
严重: Failed to initialize connector [Connector[AJP/1.3-8009]]
-
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[AJP/1.3-8009]]
-
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
-
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
-
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
-
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:821)
-
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
-
at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
-
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
-
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
-
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
-
at java.lang.reflect.Method.invoke(Method.java:606)
-
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
-
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
-
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
-
at org.apache.catalina.connector.Connector.initInternal(Connector.java:980)
-
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
-
... 12 more
-
Caused by: java.net.BindException: 地址已在使用 <null>:8009
-
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:413)
-
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:649)
-
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
-
at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
-
... 13 more
-
Caused by: java.net.BindException: 地址已在使用
-
at java.net.PlainSocketImpl.socketBind(Native Method)
-
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
-
at java.net.ServerSocket.bind(ServerSocket.java:376)
-
at java.net.ServerSocket.<init>(ServerSocket.java:237)
-
at java.net.ServerSocket.<init>(ServerSocket.java:181)
-
at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
-
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:400)
-
... 16 more
出现以上错误时,该端口即可!!不管你电脑里装了几个Tomcat改了就行了,不必卸载原来的Tomcat即可。
参考其他的博文
:http://blog.csdn.net/renfufei/article/details/9733367
http://blog.csdn.net/wangli61289/article/details/37922601
* *****顺便提一下Windows7下配置Jdk,Tomcat,网上的有些不能用******
JAVA_HOME:
C:\Program Files\Java\jdk1.7.0_51
CLASSPATH:
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; (最前面有点,不可漏)
PATH:
;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
运行DOS命令行(cmd):java -version 若有版本信息出现,即为安装成功!
至于Tomcat一般不需要在系统变量中配置:
下载apache-tomcat后只需要在其安装目录下的Tomcat_Home/bin下找到startup.bat双击运行试试,拖过出现
-
五月 07, 2015 10:14:19 上午 org.apache.catalina.core.AprLifecycleListener init
-
信息: The APR based Apache Tomcat Native library which allows optimal performanc
-
e in production environments was not found on the java.library.path: C:\Program
-
Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Window
-
s;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bi
-
n;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x
-
86;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows
-
\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86
-
)\ATI Technologies\ATI.ACE\Core-Static;H:\apache-maven-3.2.3\bin;.
-
五月 07, 2015 10:14:19 上午 org.apache.coyote.http11.Http11Protocol init
-
信息: Initializing Coyote HTTP/1.1 on http-8089
-
五月 07, 2015 10:14:19 上午 org.apache.catalina.startup.Catalina load
-
信息: Initialization processed in 656 ms
-
五月 07, 2015 10:14:19 上午 org.apache.catalina.core.StandardService start
-
信息: Starting service Catalina
-
五月 07, 2015 10:14:19 上午 org.apache.catalina.core.StandardEngine start
-
信息: Starting Servlet Engine: Apache Tomcat/6.0.18
-
五月 07, 2015 10:14:21 上午 org.apache.catalina.loader.WebappClassLoader validat
-
eJarFile
-
信息: validateJarFile(D:\各种编译工具\JAVA开发工具\apachetomcat6.0.18\apache-tom
-
cat-6.0.18\webapps\myApp\WEB-INF\lib\javax.servlet-api-3.1.0.jar) - jar not load
-
ed. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.
-
class
-
五月 07, 2015 10:14:22 上午 org.apache.coyote.http11.Http11Protocol start
-
信息: Starting Coyote HTTP/1.1 on http-8089
-
五月 07, 2015 10:14:22 上午 org.apache.jk.common.ChannelSocket init
-
信息: JK: ajp13 listening on /0.0.0.0:8009
-
五月 07, 2015 10:14:22 上午 org.apache.jk.server.JkMain start
-
信息: Jk running ID=0 time=0/158 config=null
-
五月 07, 2015 10:14:22 上午 org.apache.catalina.startup.Catalina start
-
信息: Server startup in 2622 ms
若没有error出现即为OK了(一般用eclipse开发时里需要进行tomcat位置映射,这里不说了)
还有出现error或者运行startup.bat一闪而过时。需要修改Tomcat_Home/conf/server.xml
改一下HTTP的端口号。若电脑里同时运行多个Tomcat那时需要修改配置文件中的HTTP,AJP,Server的端口号
HTTP端口号
-
<Connector port="8089" protocol="HTTP/1.1"
-
connectionTimeout="20000"
-
redirectPort="8443" />
AJP端口号
-
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Server 端口号
-
<Server port="8005" shutdown="SHUTDOWN">
-
-
<!--APR library loader. Documentation at /docs/apr.html -->
-
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
-
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
-
<Listener className="org.apache.catalina.core.JasperListener" />
-
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
-
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
-
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
就这些。
阅读(4437) | 评论(0) | 转发(0) |