Forum Stats

  • 3,750,523 Users
  • 2,250,188 Discussions
  • 7,866,998 Comments

Discussions

How to use java.nio on Mac?

2763535
2763535 Member Posts: 2
edited Oct 2, 2014 3:45PM in Generics

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());

               }

<span style="font-family: comic sans ms,sans-serif;">          }</span>

          catch ( DirectoryIteratorException x ){

               System.err.println(x);

          }

     }

}

Answers

This discussion has been closed.