Search code examples
javaeclipsejava-7nio

Error using java nio


I am using jdk 7. I want to use nio package in my program but when I am trying to import java.nio.file.* , I am getting a error that java.nio.file package does not exist !


Solution

  • I expect that your Eclipse project is configured to build against an older Java profile.

    If you are using Maven then you need to set the required Java version in the POM file.

    Otherwise, this Answer gives instructions for setting a project's target Java version.


    I am trying to compile using command prompt ,but still getting the same errors !!

    In that case, either you are compiling with a javac from an older JDK (see what javac -version tells you!!) or it is a POM file issue.