In a programe,
import java.nio.file.*;
Gives error – The import java.nio.file cannot be resolved
Following other threads, I changed JDK Compliance Level to 1.7, also added
-vm
/home/user/jdk1.7.0_79/bin/java
to eclipse.ini
Eclipse -> About -> Installation details has following lines –
java.home=/home/user/jdk1.7.0_79/jre
java.library.path=/home/user/jdk1.7.0_79/jre/lib/i386/server:/home/user/jdk1.7.0_79/jre/lib/i386:/home/user/jdk1.7.0_79/jre/../lib/i386:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386::/usr/java/packages/lib/i386:/lib:/usr/lib
java, javac versions –
user$ ~/jdk1.7.0_79/jre/bin/java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) Server VM (build 24.79-b02, mixed mode)
user$ ~/jdk1.7.0_79/bin/java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) Server VM (build 24.79-b02, mixed mode)
user$ ~/jdk1.7.0_79/bin/javac -version
javac 1.7.0_79
How should I correctly import java.nio.file.*
?
Best Answer
Solved it!
Even after doing all the recommended things it wasn't working. Finally saw a setting in another thread that I hadn't tried till now.
Done.
So even when eclipse installation details configuration may show all the correct numbers, we still have to explicitly add 1.7 library from project properties.