Menu

java.io.FileNotFoundExcpetion

Help
Zac
2008-09-01
2013-03-18
  • Zac

    Zac - 2008-09-01

    Need some help using jacksum.

    I'm trying to create a checksum for a directory via java.

    When I call via commandline: where [dir] is the fully qualified directoryname:
    jacksum -S -w {dir}  it works just fine, but when I try to do the same thing via java I'm getting the error:

    java.io.FileNotFoundException: [dir](Access is denied)

    This is a windows NTFS system, and just to make sure I set the permissions to Everyone "Full Control" and I'm still getting the error.

    Here's a snippit of what I'm doing via java:

    AbstractChecksum checksum = JacksumAPI.getChecksumInstance("sha1", true);
    long bytesread = checksum.readFile([dir], false);

    When I call the readFile it's throwing the error.  ANY help would be much appreciated!

    Thanks,
    -Zac Morris

     
    • Johann N. Löfflmann

      Hi Zac,

      the checksum.readFile() method requires a filename as 1st parameter rather than a directory. In order to calculate a "directory hash" as "jacksum -S -w {dir}" can do for you, you need to implement the -S feature in your program. In Jacksum 1.7.0 there is no API to do it (I just put it on the wishlist). Search for _S in jonelo/jacksum/cli/Jacksum.java to see how the -S feature works.

      Regards,
      jonelo

       

Log in to post a comment.