Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Extract files to /opt/tomcat

    1. In the directory with the tar file, run sudo -u tomcat tar -xzvf <tomcat9>.tar.gz --strip-components=1 -C /opt/tomcat

  2. Create a systemd service file for Tomcat

    1. sudo vim /etc/systemd/system/tomcat.service

    2. Paste the following

      1. Code Block
        [Unit]
        Description=Apache Tomcat
        After=network.target
        
        [Service]
        Type=forking
        
        User=tomcat
        Group=tomcat
        
        Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
        Environment=CATALINA_PID=/opt/tomcat/tomcat.pid
        Environment=CATALINA_HOME=/opt/tomcat
        Environment=CATALINA_BASE=/opt/tomcat
        Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
        
        ExecStart=/opt/tomcat/bin/startup.sh
        ExecStop=/opt/tomcat/bin/shutdown.sh
        
        ExecReload=/bin/kill $MAINPID
        RemainAfterExit=yes
        
        [Install]
        WantedBy=multi-user.target

    3. Save the file and exit

  3. Make systemd aware of the new file

    1. sudo systemctl daemon-reload

    2. sudo systemctl enable --now tomcat (starts Tomcat and also makes it run on startup)start tomcat

    3. sudo systemctl status tomcat

    4. Visit http://localhost:8080/ and you should see a confirmation page

  4. I also followed the steps to create a web manager user, but I don’t believe it’s necessary to continue

  5. Make sure to stop Tomcat before you try running it with IntelliJ later!

    1. sudo systemctl stop tomcat

Install stand-alone version of STEP

...

java.lang.UnsupportedClassVersionError: org/eclipse/jdt/internal/compiler/env/INameEnvironment has been compiled by a more recent version…
  • Seems I originally installed tomcat9 via apt, but it seems like I hit a known bug (

  • The workaround in the first link didn’t work for me… So I re-traced my steps

    • (undoing the workaround)

      • sudo apt remove libecj-java

      • sudo unlink /var/lib/tomcat9/lib/ecj.jar

    • (undoing our other another workaround for Smart Tomcat, if you used apt)

      • sudo unlink /usr/share/tomcat9/conf

    • (removing tomcat via apt)

      • sudo apt purge tomcat9 tomcat9-admin (purge removes config files too)

    • (remove user and group automatically added by apt)

      • sudo userdel tomcat

      • sudo groupdel tomcat