Could not target platform: ‘java se 11’ using tool chain: ‘jdk 8 (1.8)’.

Explanation:

When using tools or frameworks that require a specific version of the Java platform, it is important to ensure that your toolchain is compatible with that version. In this case, the platform being targeted is ‘Java SE 11’ and the toolchain being used is ‘JDK 8 (1.8)’. However, JDK 8 does not include support for Java SE 11 by default.

To target Java SE 11 using JDK 8, you need to perform the following steps:

  1. Ensure you have JDK 8 (1.8) installed on your system. You can download it from the official Oracle website.
  2. Download and install the Java Development Kit (JDK) for Java SE 11 from the official Oracle website or any other trusted source.
  3. Configure your development environment to use the Java SE 11 JDK instead of the default JDK 8. You can do this by modifying the PATH environment variable or configuring your IDE to use the Java SE 11 JDK.
  4. Update your build or project configuration to specify the target platform as ‘Java SE 11’ instead of the default ‘Java SE 8’.

Here is an example of how you can specify the target platform in a Maven project’s pom.xml file:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
    </plugins>
</build>

This configuration tells Maven to use Java SE 11 as the source and target platform. Make sure to update the plugin version accordingly if a newer version is available.

Same cateogry post

Leave a comment