Wiki source code of Changer de version de Java
Last modified by Aurelie Bertrand on 2025/10/09 14:40
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | = Checking the current version = | ||
| 2 | |||
| 3 | There are two ways of checking the version currently used by tomcat : | ||
| 4 | |||
| 5 | * Open the** **page **[[Server status>>doc:Digdash.deployment.configuration.server_status.WebHome]]**: the Java version in use is indicated in the **Global** status section (in this example, Java 17). | ||
| 6 | [[image:Java_server_status_EN.png]] | ||
| 7 | |||
| 8 | * Check the version by going to the Java directory: | ||
| 9 | *1. In a terminal, enter the following command: | ||
| 10 | |||
| 11 | {{code language="shell"}} | ||
| 12 | cd /usr/lib/jvm | ||
| 13 | ll | ||
| 14 | {{/code}} | ||
| 15 | |||
| 16 | (% start="2" %) | ||
| 17 | 1. Look at which version the default-java symbolic link is currently pointing to. | ||
| 18 | In the example below, it is pointing to java 11. | ||
| 19 | [[image:Check_java_version_FR.png||alt="Version java"]] | ||
| 20 | |||
| 21 | = Changing the Java version = | ||
| 22 | |||
| 23 | To change the Java version | ||
| 24 | |||
| 25 | 1. Shut down tomcat: | ||
| 26 | |||
| 27 | {{code language="shell"}} | ||
| 28 | sudo service tomcat9 stop | ||
| 29 | {{/code}} | ||
| 30 | |||
| 31 | (% start="2" %) | ||
| 32 | 1. Delete the symbolic link: | ||
| 33 | |||
| 34 | {{code language="shell"}} | ||
| 35 | sudo rm /usr/lib/jvm/default-java | ||
| 36 | {{/code}} | ||
| 37 | |||
| 38 | (% start="3" %) | ||
| 39 | 1. Recreate the symbolic link to the desired version: | ||
| 40 | |||
| 41 | {{code language="shell"}} | ||
| 42 | # Change X java-1.1X to the desired version (here java 17) | ||
| 43 | sudo ln -s /usr/lib/jvm/java-1.17.0-openjdk-amd64 /usr/lib/jvm/default-java | ||
| 44 | {{/code}} | ||
| 45 | |||
| 46 | (% start="4" %) | ||
| 47 | 1. Check that the link points to the desired version: | ||
| 48 | |||
| 49 | {{code}} | ||
| 50 | ll | ||
| 51 | {{/code}} | ||
| 52 | |||
| 53 | (% start="5" %) | ||
| 54 | 1. Start tomcat: | ||
| 55 | |||
| 56 | {{code language="shell"}} | ||
| 57 | sudo service tomcat9 start | ||
| 58 | {{/code}} |