• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Program Cannot Write To Hard Drive: Windows 7

 
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to tell us some details. What does your code look like? What error are you getting? What is the path you are trying to write? Do you have permission to write there?
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic