How to import java.nio.file package
Solution 1
You've different version of JDKs. You just need to set JDK7/JRE7
version eclipse project. You may also select the Execution environment JRE
to JavaSE 7 while creating a new project.
The JDK your projects use to compile, the version of the resulting class files, the JRE they used to execute and the JDK eclipse runs with are widely independent settings.
Solution 2
The New I/0 is named as the NIO in javaSE 7.0 ("Dolphin").
The below link described as in details.
Related videos on Youtube
user1457150
Updated on July 09, 2022Comments
-
user1457150 almost 2 years
Im trying to listen to a directory for changes, then discovered java.nio.* was developed to handle efficiently such tasks and more. Then downloaded jdk1.7.0_02 from oracle and started eclipse with it. Then created new java project, tryed to implement some class from java.nio.file and Oh my eyes! "The import java.nio.file cannot be resolved". Do i have to find some .jar in the whole jdk1.7.0_02 directory that contains such package? or is something wrong with my classpath? Thank you in advance!!
-
user1457150 almost 12 yearsThank you very much. It worked like a charm. Just defined the compliance level to 1.7 instead of 1.6
-
Vishy almost 12 years
java.nio
has been available since Java 1.4 released in 2000, you don't have to have java 7 to use it. -
KV Prajapati almost 12 yearsBut he/she wants to import
java.nio.file
package. -
user1457150 almost 12 yearsi have a Dynamic Web Project, just edited the .classpath file to match this
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_05">
-
Vaishali Sutariya almost 9 yearsplease explain how will i do that bcoz m using eclipse .. while creating project it cant be ask or no option of Execution environment JRE..
-
Sudipto over 7 yearsuse JDK version "jdk1.8.0_25". This will resolve the NIO issue