Helen
Helen

Reputation: 13

Can I change a java class version file without changing the overall version?

I have the error java.lang.UnsupportedClassVersionError: org/dita/dost/invoker/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 and I understand that there is a compatability issue with the class file. I am using

java version "1.8.0_351" Java(TM) SE Runtime Environment (build 1.8.0_351-b10) Java HotSpot(TM) Client VM (build 25.351-b10, mixed mode, sharing) with the DITA OT which states that I should have java version 17 or above. I understand class file version 52 to be from Java 8.

this tells me that java version 18 should be compatable with class file version 52, but I don't know how to locate the class file or how to change it, or where to get the replacement file 52. I am completely new to java and the dita toolkit.

I have set JAVA_HOME /Java/jre1.8.0_351 and PATH /Java/jre1.8.0_351/bin.

Upvotes: 0

Views: 436

Answers (1)

Stephen C
Stephen C

Reputation: 719376

According to the dita-ot project's README file (on GitHub):

"To build and run DITA-OT, you’ll need Java Development Kit (JDK), version 17 or newer."

You are trying to run it on Java 8. That is not supported in the current version of dita-ot.

If you want to run dita-ot on Java 8, you will need to download and build an older version. (I think ... prior to version 4.0, though I'm not sure about that.)


Can I change a java class version file without changing the overall version?

You cannot "change" the class file version number without recompiling. And in this case, I don't think that you will succeed in recompile the latest version of dita-ot with Java 8 as the target version.

Why?

Because the rationale given for changing is this:

"Java 8 is currently still LTS but e.g. Oracle's commercial distribution has been discontinued and the latest LTS version is 17. While e.g. AdoptOpenJDK plans to backport fixes until 2023, new features are being added to the language and it would be nice to be able to use them.

Move to Java 17 in the build configuration to allow using Java 9-17 features."*

I assume that they will have started using Java 9+ features by now.

Upvotes: 0

Related Questions