I recently purchased Head First Java 2nd Ed. and tried to do the Phrase-O-Matic program on page 16. The only way I was able to actually do it is to turn off the User Account Control in order for the compiler to actually do anything with the text script. Does any one have a clue as to why that is? I'm running on Windows Vista 64-bit.
This is really outside of Beginning Java, though I don't know where else you'd put it in this set of forums.
Vista and Windows 7 appear to take the attitude that, if your program attempts to write anywhere they they regard as "not in your area", then they don't allow it. Sometimes they give you a message about it, sometimes they don't. Having an administrator account, which used to give you "all privileges" on an XP box, no longer does. Turning off User Account Control seems to disable this behavior.
I'm afraid I don't have much more than that. And my opinion of it isn't nice.
Where exactly are you trying to access the file from? Windows Vista and 7 get angry if a program who is not explicitly run "as Administrator" is trying to access/modify files outside of area where Windows thinks it should be meddling. For example, Windows Vista and 7 likes to restrict all access to files within "Program Files" unless the program has direct coloration to the folders in question (or again explicit administrator access, by which I mean when you are directly prompted to click "Yes" or "I Agree" to access a file/folder in the wonderful Windows pop-ups) If you have not already done so, I would place the file you need access to in a public location such as you "Documents" folder or directly in your workspace for Eclipse. Let us know where exactly your file which needs to be accessed is located and also if the user which you are logged in as has full rights on the system.
Campbell Ritchie wrote:create a folder in "Documents".
There, fixed it. Since Windows Vista, it's no longer "My Computer", "My Documents", "My Music", "My Pictures", etc. The "My" part has been dropped; Microsoft has taken control of these folders
I uninstalled/reinstalled JDK and now everything works fine. Here's what I think was causing the problem: I had a JRE in the folder Program Files (x86) and my JDK was in the folder Program Files. While trying to figure out what was going on I read somewhere that if I had JREs in two different locations I might run into a problem. I forgot where I read that but it's what led me to even know about the User Account Control thing.