0

As Ubuntu20.04 doesn't have tomcat8 in default pkg, I am trying to install it manually using these commands:

sudo wget -c http://launchpadlibrarian.net/366407131/tomcat8_8.5.30-1ubuntu1_all.deb http://launchpadlibrarian.net/366407127/tomcat8-common_8.5.30-1ubuntu1_all.deb http://launchpadlibrarian.net/366407125/libtomcat8-java_8.5.30-1ubuntu1_all.deb
sudo apt install -y ./libtomcat8-java_8.5.30-1ubuntu1_all.deb ./tomcat8_8.5.30-1ubuntu1_all.deb ./tomcat8-common_8.5.30-1ubuntu1_all.deb

But this version installs java11 by default, is there any way to change this default java version to java8

matigo
  • 20,403
  • 7
  • 43
  • 70

1 Answers1

1

You can install The OpenJDK 8 package from the standard repositories:

sudo apt install openjdk-8-jdk

From there you can check the version, which should look something like this:

java -version
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (build 1.8.0_302-8u302-b08-0ubuntu2-b08)
OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)

From there you can follow this answer to install Tomcat 8.5.30

matigo
  • 20,403
  • 7
  • 43
  • 70
  • I could see these errors after installing tomcat8 from apt 24-Nov-2021 21:46:21.951 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 95238 ms 24-Nov-2021 21:46:22.107 SEVERE [http-nio-8080-exec-4] org.apache.coyote.AbstractProtocol$ConnectionHandler.process Error reading request, ignored java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer; – Java_Arc Nov 25 '21 at 01:24