Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use java.nio on Mac?

2763535Sep 28 2014 — edited Oct 2 2014

I am getting the error "cannot find symbol" on "Path", "FIles", etc. I am using javac and java 1.8.0_20 on Mac OS X 10.9.2 and the Terminal. Thanks.

import java.io.*;

import java.nio.*;

class a{

     public static void main(String args[]) throws IOException{

          Path directorio = "/Users/Josue/Desktop/";

          try {

               DirectoryStream<Path> stream = Files.newDirectoryStream(dir);

               for( Path file: stream ){

                    System.out.println(file.getFileName());

               }

          }

          catch ( DirectoryIteratorException x ){

               System.err.println(x);

          }

     }

}

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2014
Added on Sep 28 2014
2 comments
2,427 views