CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Posts
    2

    file owner's name in java

    using jdk 1.7 how can I retrieve the owner's name of a file. piece of code is as follows.getting error
    cannot find FileRef and Attributes class.

    FileRef file=Paths.get("name and location of file with extension");
    UserPrincipal principal=Attributes.getOwner(file);
    System.out.println("File's owner is "+principal.getName());

    if there is some other method to get file owner's name then please suggest. I would be great with an example

  2. #2
    Join Date
    Feb 2012
    Posts
    1

    Re: file owner's name in java

    the error may be due to the classpath settings. watch the classpath settings is pointed to the new java 1.7 version or not

  3. #3
    Join Date
    Feb 2012
    Posts
    2

    Re: file owner's name in java

    I've checked the path. the error it reports is incompatible type

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: file owner's name in java

    I've checked the path. the error it reports is incompatible type
    That's not the error you posted in your first post which says "cannot find FileRef and Attributes class."

    Please post the full compiler error message and the section of code it relates to.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured