Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Java Version for Apache Tomcat 9 [duplicate]

So I'm running apache tomcat 9, when I check the /manager page it shows the jvm version as 11.0.8+10-post-Ubuntu-0ubuntu118.04.1.

I want to use Java version 8, how would I change this?

I have read around online and could not find anything that works.

OS: ubuntu 18.04

It's not a duplicate because I have read that post already and I found the answers unhelpful / not working. (Also that thread is targeted toward the windows OS as I'm based on Ubuntu (CLI only).)

like image 374
user12346306 Avatar asked Sep 16 '25 03:09

user12346306


1 Answers

There are multiple ways of doing so.

  1. Chaining global JAVA_HOME environment variables to the java you wish to use. Note that this will change Java for all apps running on that machine.

  2. Using setenv file. In CATALINA_BASE/bin directory open or create file named setenv.sh and put JAVA_HOME=/usr/lib/jvm/openjdk-8-jdk in it. This will change it only for your tomcat. Please note to change it to the JDK/JRE you want to use.

like image 139
Pavel Polivka Avatar answered Sep 18 '25 16:09

Pavel Polivka