Reputation: 35
As the title says, I'm checking if a file exists or not with java. The file is stored in
C:\Windows\System32.
If I run the project with Netbeans
, no problem. It returns true.
But if I run the .jar
, it returns false.
I'm admin of the computer, but I don't know which privilege I have when I run the .jar
.
Do you have any idea
Upvotes: 0
Views: 1031
Reputation: 3048
According to this Oracle tutorial, you should check also Files.notExists
- if it returns false
, too, your program failed to verify the existence of the file.
Upvotes: 3
Reputation: 43
Maybe you have to run CMD as an administrator and then run your .jar file, like you didn't post the code we can't get a good idea about your issue.
Upvotes: 0
Reputation: 727
Try to run cmd.exe as an admin and then run your .jar from this cmd. Being an admin does not mean you are starting your apps with admin privilege.
Upvotes: 3