0

I need to run tomcat6 with Java 8 and keep Java 6 as the default JRE on CentOS.

I have succeeded on unpacking a tar version of tomcat6 on centOS and doing so, but when I use the yum package, for some reason, there is no catalina.sh and I cannot just run "catalina.sh" with JAVA_HOME set to whatever I want.

I have seen that on tomcat6.conf there is a variable called "JAVA_HOME" and I have set it to the right value, but it still uses java 6.

Can anybody help me?

1 Answer 1

1

As you can see from the startup script, what's getting launched is actually the script in

/usr/sbin/tomcat6

Inside there, you will find that to set its enviroment variables the script launches the function

set_java_cmd

sourced from the file

/usr/share/java-utils/java-functions

Look at that last file and you'll find everything needed to bypass the default options, the file is decently commented.

About tomcat6 being ok with the JDK8 instead, that's for you to discover :)

3
  • Thanks, I am not very good with scripts though... I dont see where I have to set my $JAVA_HOME. I have set it through the command line but it does not use it neither... could you please, if it is not much to ask, give me an example of what I have to modify or add? I'd appreciate it a lot. Sorry to bother you too much.
    – luanjot
    Jan 13, 2014 at 10:16
  • 1
    Based on that configuration file, you have two options: either override the _JAVA_HOME variable right at the beginning, or (leaving you more possibilities) have a java configuration file under the home directory of the user who will run tomcat (the default user is "tomcat"). The file will be /home/tomcat/.java/java.conf and you can look at the system-wide one in /etc/java/java.conf for configuration options.
    – stoned
    Jan 13, 2014 at 10:36
  • OK. Thank you!! I had done it correctly... but I had set it to JAVA HOME and not JRE HOME. Facepalm. Thank you for your help!
    – luanjot
    Jan 13, 2014 at 11:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .