0

It comes from https://mybatis.org/mybatis-3/getting-started.html.

try (SqlSession session = sqlSessionFactory.openSession()) { // do work } 

when I copy the code into editior . I get an error

try with resources are not supported at language level 5

how comes the problem?

4
  • Also have a look at the doc Commented Jan 27, 2020 at 13:26
  • 1
    As for the "not supported at language level 5", that sounds like an IDE problem to me. Make sure you've configured your project to use Java 7 or later. Commented Jan 27, 2020 at 13:28
  • I fixed the problem by add <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>8</source> <target>8</target> </configuration> </plugin> </plugins> </build> to pom.xml for maven . not sure what's that but It works for me. Commented Jan 27, 2020 at 13:33
  • It means you're targeting Java 8. Your IDE probably read the pom.xml file and auto-configured itself for development in Java 8. Commented Jan 27, 2020 at 13:51

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.