一台机子上运行使用不同Java版本的多个tomcat

方法

在tomcat/bin/下创建setenv.sh并写入 export JAVA_HOME=/usr/share/jvm/jdk1.8.0_91 

When you starting tomcat using catalina.sh, it searching for file setenv.sh and sourcing it. It is searching in CATALINA_HOME or CATALINA_BASE.

即启动tomcat时会先在bin/下找setenv.sh,如果里面设置了JAVA_HOME则优先用之。

Setting JAVA_HOME in setenv.sh gives you ability to use different tomcats with different applications that need different version of java, but running by one user. Other user environment would not be affected by you.

相关:http://askubuntu.com/questions/468772/tomcat-does-not-recognize-java-home

当然,还需要修改监听端口,使不同tomcat实例监听的端口不同。

posted @ 2016-07-11 01:24  March On  阅读(1196)  评论(0编辑  收藏  举报
top last
Welcome user from
(since 2020.6.1)