Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Dependency Management

Java.nio class errors

Hello,

This question is regarding the Maven workshop.

I am getting a lot of errors related to the Java.nio classes, Path and WatchService

Usage of API documented as @since 1.6+

How should this be changed for SDK 1.8+

Thanks, Chitra Sharathchadnra

3 Answers

Brian Pedigo
Brian Pedigo
26,783 Points

I was having the same issue that you are. The way I was able to fix this was by adjusting the following setting in intellij:

File -> Project Structure -> Project Settings -> Modules -> "Your Module Name" -> Sources -> Language Level

and change that to the desired level i.e 1.8 or the Project Default language level.

Once I did this the error was fixed.

Thank you! I was changing it for all files and I only needed to change it for Main and then it worked.

You can also add this to the pom.xml

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>