- Manel Lurbe Sempere ([email protected])
-
Uninstall the open-jdk installed on your system:
sudo apt-get update && sudo apt-get remove openjdk* -
Get JAVA JDK from Java openJDK, or other maintainer version like Oracle or Amazon and decompress:
tar -zxvf jdk*.tar.gz -
Place it into the folder:
sudo mkdir /usr/lib/jvm/jdk-21.0.3/ sudo mv jdk*/ /usr/lib/jvm/jdk-21.0.3/ -
Install the java alternatives:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-21.0.3/bin/java" 0 sudo update-alternatives --set java /usr/lib/jvm/jdk-21.0.3/bin/java -
Install the javac alternatives:
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-21.0.3/bin/javac" 0 sudo update-alternatives --set javac /usr/lib/jvm/jdk-21.0.3/bin/javac -
In /etc/environment:
sudo nano /etc/environment- Define JAVA_HOME:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" JAVA_HOME="/usr/lib/jvm/jdk-21.0.3"
- Define JAVA_HOME:
-
Refresh the environment:
source /etc/environment -
Check Java compiler version:
javac -version- Correct output example:
javac 21.0.3
- Correct output example:
-
Check Java VM version:
java -version- Correct output example:
java version "21.0.3" 2024-04-16 LTS Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152) Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)
- Correct output example:
-
Download Apache Maven and decompress:
tar -zxvf apache-maven-*.tar.gz -
Install Apache Maven on this folder:
sudo mkdir /opt/apache-maven sudo chown user:user /opt/apache-maven/ mv apache-maven-*/* /opt/apache-maven/ -
In /etc/environment:
sudo nano /etc/environment- Define MAVEN_HOME:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/apache-maven/bin" JAVA_HOME="/usr/lib/jvm/jdk-21.0.3" MAVEN_HOME="/opt/apache-maven"
- Define MAVEN_HOME:
-
Refresh the environment:
source /etc/environment -
Check Maven version:
mvn --version- Correct output example:
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /opt/apache-maven Java version: 21.0.3, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-21.0.3 Default locale: es_ES, platform encoding: UTF-8 OS name: "linux", version: "6.8.0-35-generic", arch: "amd64", family: "unix"
- Correct output example:
-
Download Apache Tomcat and decompress:
tar -zxvf apache-tomcat-*.tar.gz -
Install Apache Tomcat on this folder:
sudo mkdir /opt/apache-tomcat sudo chown user:user /opt/apache-tomcat/ mv apache-tomcat-*/* /opt/apache-tomcat/ -
In /etc/environment:
sudo nano /etc/environment- Define CATALINA_HOME:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/apache-maven/bin:/opt/apache-tomcat/bin" JAVA_HOME="/usr/lib/jvm/jdk-21.0.3" MAVEN_HOME="/opt/apache-maven" CATALINA_HOME="/opt/apache-tomcat"
- Define CATALINA_HOME:
-
Refresh the environment:
source /etc/environment -
Check Maven version:
catalina.sh version- Correct output example:
Using CATALINA_BASE: /opt/apache-tomcat Using CATALINA_HOME: /opt/apache-tomcat Using CATALINA_TMPDIR: /opt/apache-tomcat/temp Using JRE_HOME: /usr/lib/jvm/jdk-21.0.3 Using CLASSPATH: /opt/apache-tomcat/bin/bootstrap.jar:/opt/apache-tomcat/bin/tomcat-juli.jar Using CATALINA_OPTS: Server version: Apache Tomcat/10.1.25 Server built: Jun 14 2024 19:31:59 UTC Server number: 10.1.25.0 OS Name: Linux OS Version: 6.8.0-35-generic Architecture: amd64 JVM Version: 21.0.3+7-LTS-152 JVM Vendor: Oracle Corporation
- Correct output example:
-
Download Java openJDK, or other maintainer version like Oracle or Amazon and decompress in the desired install folder.
-
Go to "Configuración" -> "Sistema" -> "Configuración avanzada del sistema" -> "Opciones avanzadas" -> "Variables de entorno..."
-
Edit the "Path" variable and add a entry pointing to the path of the java jdk binary files.
- Create a new variable named as "JAVA_HOME" pointing to the java folder.
-
Download Apache Maven and decompress in the desired install folder.
-
Go to "Configuración" -> "Sistema" -> "Configuración avanzada del sistema" -> "Opciones avanzadas" -> "Variables de entorno..."
-
Edit the "Path" variable and add a entry pointing to the path of the maven binary files.
-
Create a new variable named as "MAVEN_HOME" pointing to the maven folder.
-
Download Apache Tomcat and decompress in the desired install folder.
-
Go to "Configuración" -> "Sistema" -> "Configuración avanzada del sistema" -> "Opciones avanzadas" -> "Variables de entorno..."
-
Edit the "Path" variable and add a entry pointing to the path of the apache binary files.
-
Create a new variable named as "CATALINA_HOME" pointing to the apache folder.

