Changing Java version
Last modified by Aurelie Bertrand on 2024/12/12 15:29
Checking the current version
There are two ways of checking the version currently used by tomcat :
- Open the page Server status: the Java version in use is indicated in the Global status section (in this example, Java 17).
- Check the version by going to the Java directory:
- In a terminal, enter the following command:
cd /usr/lib/jvm
ll
ll
- Look at which version the default-java symbolic link is currently pointing to.
In the example below, it is pointing to java 11.
Changing the Java version
To change the Java version
- Shut down tomcat:
sudo service tomcat9 stop
- Delete the symbolic link:
sudo rm /usr/lib/jvm/default-java
- Recreate the symbolic link to the desired version:
# Change X java-1.1X to the desired version (here java 17)
sudo ln -s /usr/lib/jvm/java-1.17.0-openjdk-amd64 /usr/lib/jvm/default-java
sudo ln -s /usr/lib/jvm/java-1.17.0-openjdk-amd64 /usr/lib/jvm/default-java
- Check that the link points to the desired version:
ll
- Start tomcat:
sudo service tomcat9 start