This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am using Windows 7 and Java 6 update 20. My program has a user interface through which data is passed and must be written, but Windows will not allow my prgram to write to the hard drive. How do I get my program to request permission to write to the hard drive?
The program, at start up, attempts to copy a text file from an encrypted archive. The archive uses the TrueZip classes, which on there own function very well. Attempting to copy a blank text file at start up has the result of prompting the user to enter a password which allows the rest of the program to load and start. If I set Windows to allow all permissions, the program starts perfectly. There is also no error message, because as you can see, the program exits if the text file is not extracted. This problem has to do with the permissions granted on Windows Vista and Windows 7. Other programs, upon the first time starting up, ask for this permission and then never ask it a second time, if I am correct. There must be some way of granting a java program permission once and for all, because the the code written in Java runs extremely quickly and brilliantly.
Either PostRealCode or TellTheDetails. java.io.File has no "copyTo" method. java.nio.file.Path (since Java 7) does but you're not using that in that code snippet. So either you haven't posted your real code, or you should tell us from which library this "File" class comes from.
Sorry for not posting the details. It is not a java.io.File. It is a de.schlichtherle.io.File (TrueZip classes) which contains the copyTo method. I just tried something and the program is able to write to the hard drive. I rightclicked on the folder in which the program files reside and manually gave the program permission, but there must be some way of doing this programatically. The dummy file is written to the user folder and the program then starts.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Program Cannot Write To Hard Drive: Windows 7