Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am attempting to use JDK 7's "try-catch with resources" statement; IntelliJ highlights my resource line, saying

Try-with-resources are not supported at this language level.

When I try to compile, I get:

java: try-with-resources is not supported in -source 1.6 (use -source 7 or higher to enable try-with-resources)

I checked that try-with-resources is enabled for my current project, and that my project is using JDK 7 (Library: C:Program FilesJavajdk1.7.0_11). Any ideas? I can't figure out what option to change (if that's even the issue).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
227 views
Welcome To Ask or Share your Answers For Others

1 Answer

Click on the File menu, open Project Structure, then under "Settings" there should be "Project". Within that tab, there'll be an SDK Settings option which specifies the language version you want to use.

See the JetBrains help page for more details ("Project language level").


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...