<<< Paths and Path classes     Index     Example: Retrieving Information about a Path >>>

3. Using the Path class


  1. Determine the default file system on the host computer

    
        FileSystem fs = FileSystems.getDefault();
    
    
  2. Define a Path using the FileSystem.getPath() method

    
        Path path = fs.getPath( "C:\\example\\Data.txt" );
    
    

    Note: the specified path can be either absolute or relative

    A relative path is a path relative to the current directory

     


<<< Paths and Path classes     Index     Example: Retrieving Information about a Path >>>