Java SDK App issue

I am facing an error when running the sample application provided in couchbase docs, need help in correcting the error.

Unsupported class file major version 58

This message means some of your code or dependencies were compiled to target Java 14, but you’re trying to run the with an earlier version of Java.

Thanks,
David

I have JDK 14 installed on my machine. I have added properties to the pom file to make use of JDK 14 for compiling the application.

If the properties are not changed, it is throwing and error to use java 7 or 8

 <!-- for jdk14 compilation -->
    <properties>
        <maven.compiler.source>14</maven.compiler.source>
        <maven.compiler.target>14</maven.compiler.target>
      </properties>

It looks like you might be using Spring Boot 2.1.5? The release notes for Spring Boot 2.2.6 say it’s the first version to support Java 14. Does upgrading to 2.2.6 resolve the issue?

Thanks,
David

Didn’t try that, will give a try

Able to run the app with changes to pom.xml redirecting it to spring boot 2.2.6

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.6.RELEASE</version>
    </parent>
1 Like