Jakarta ServletConfig gives wrong version error

I just cloned dwr-2024 from the GitHub repo ‘master’ branch. I ran $ ant jar from the repo root, and build compilation failed with this error:

    [javac] Compiling 195 source files to .../dwr-2024/target/ant/classes/main
    [javac] .../dwr-2024/core/api/main/java/org/directwebremoting/ServerContext.java:5: error: cannot access ServletConfig
    [javac] import jakarta.servlet.ServletConfig;
    [javac]                       ^
    [javac]   bad class file: .../dwr-2024/target/ant/lib/jakarta.servlet-api-6.1.0.jar(jakarta/servlet/ServletConfig.class)
    [javac]     class file has wrong version 55.0, should be 52.0
    [javac]     Please remove or make sure it appears in the correct subdirectory of the classpath.

It doesn’t look like this is something I can fix. Can anyone here help?

I’m using Java openjdk version “1.8.0_442” on Ubuntu 22.04.

Thank you.

The error means the servlet API jar was compiled for Java 11 (class file 55), while your javac is Java 8 (52). Run Ant with JDK 11 or newer, not just change source/target: set JAVA_HOME to the newer JDK, put its bin first on PATH, then run ant clean jar. If the project must build on Java 8, replace that dependency with a Java 8-compatible servlet API version, but DWR’s current master may simply require a newer JDK.