Switch to Java21 on Linux: Difference between revisions

From LogicalDOC Community Wiki
Jump to navigationJump to search
m minor corrections
Line 11: Line 11:


Hint for Ubuntu:
Hint for Ubuntu:
<source>$ apt install -y openjdk-21-jdk</source>
<source lang="bash">$ apt install -y openjdk-21-jdk</source>
Hint for CentOS and RedHat:
Hint for CentOS and RedHat:
<source>
<source lang="bash">
$ wget https://download.java.net/openjdk/jdk21/ri/openjdk-21+35_linux-x64_bin.tar.gz
$ wget https://download.java.net/openjdk/jdk21/ri/openjdk-21+35_linux-x64_bin.tar.gz
$ tar xvf openjdk*
$ tar xvf openjdk*
Line 22: Line 22:
</source>
</source>


2. With VI, or any other text editor, open the file '''<LDOC_HOME>'''/bin/logicaldoc.sh.
2. manage othe version of Java on the same server
If you have a previous version of Java installed, you can set the default version using the <em>update-alternatives</em>command.
<source lang="bash">
$ sudo update-alternatives --config java
</source>
 
3. With VI, or any other text editor, open the file '''<LDOC_HOME>'''/bin/logicaldoc.sh.
Inside that file, locate the variable '''JAVA_HOME''' and make sure it points to the Java21 installation folder:<br>
Inside that file, locate the variable '''JAVA_HOME''' and make sure it points to the Java21 installation folder:<br>
Probable path in Ubuntu:
Probable path in Ubuntu:
<source>export JAVA_HOME=/usr</source>
<source lang="bash">export JAVA_HOME=/usr</source>


Probable path in CentOS and RedHat:
Probable path in CentOS and RedHat:
<source>export JAVA_HOME=/usr/java/latest</source>
<source lang="bash">export JAVA_HOME=/usr/java/latest</source>


3. Iterate the point 2 for this list of additional files:
4. Iterate the point 2 for this list of additional files:
* '''<LDOC_HOME>'''/bin/update.sh
* '''<LDOC_HOME>'''/bin/update.sh
* '''<LDOC_HOME>'''/bin/patch.sh
* '''<LDOC_HOME>'''/bin/patch.sh

Revision as of 08:11, 9 June 2025

Reconfigure LogicalDOC to use Java 21 on Linux

Starting from version 9.0.1 LogicalDOC does not work with Java 17 anymore so you have to install Java 21. Please read first how to install the right Java to use with LogicalDOC.

It is important to install Java 21 and not Java 22 nor Java 23, because Java21 is the latest LTS (Long Term Support) release available at the moment.

Given <LDOC_HOME> the installation path of LogicalDOC (by default it is /LogicalDOC), please proceed as follows:

1. Install Java 21 from Oracle or OpenJDK21

Hint for Ubuntu:

$ apt install -y openjdk-21-jdk

Hint for CentOS and RedHat:

$ wget https://download.java.net/openjdk/jdk21/ri/openjdk-21+35_linux-x64_bin.tar.gz
$ tar xvf openjdk*
$ sudo mv jdk-21 /usr/java/
$ sudo ln -sfn /usr/java/jdk-21 /usr/java/latest
$ sudo ln -sfn /usr/java/jdk-21 /usr/java/default
$ sudo ln -sfn /usr/java/latest/bin/java /usr/bin/java

2. manage othe version of Java on the same server If you have a previous version of Java installed, you can set the default version using the update-alternativescommand.

$ sudo update-alternatives --config java

3. With VI, or any other text editor, open the file <LDOC_HOME>/bin/logicaldoc.sh. Inside that file, locate the variable JAVA_HOME and make sure it points to the Java21 installation folder:
Probable path in Ubuntu:

export JAVA_HOME=/usr

Probable path in CentOS and RedHat:

export JAVA_HOME=/usr/java/latest

4. Iterate the point 2 for this list of additional files:

  • <LDOC_HOME>/bin/update.sh
  • <LDOC_HOME>/bin/patch.sh
  • <LDOC_HOME>/bin/restart.sh
  • <LDOC_HOME>/bin/reset-passwd.sh

4. Restart LogicalDOC