I'm baffled by a recent discovery with one of my programs. I'm still in beta testing, so this was a good time to catch the issue. But it seems that, when installed on a 64-bit system, the data files are simply not written. If you are running a 64-bit system, you may install my software from here. You'll notice that if you launch it, customize it, close it, and relaunch, all of your customization will be missing. If you do the exact same thing on a 32-bit system, your information is saved--a lib folder is created to store program data files.

As far as I can gather, this only occurs on 64-bit systems. The systems I have tested it on have been Windows 7, so I don't know if that's playing a part. Regardless, it seems as though this is an issue with the runtime environment rather than my coding. Am I the only one who has ever experienced an issue like this, and am I simply doing something wrong? I'm simply using a BufferedWriter to output data files ...

If you're interested in seeing my code, I can provide you with the source.

Recommended Answers

All 5 Replies

You could show some of your code. And try some debug-like print statements to see what happens, and what doesn't. And, I assume, you do not have any empty catch blocks?

I discovered that the issue is that 64-bit Windows will not allow me to write to my data folders if they are stored within Program Files. I got around this by moving them to the user's home directory, in Application Data (or Application Support on OS X). In general, this just seems like a smarter idea and I should have been doing it all along.

However, this does not resolve the issue of updates. When I download and install an update for the user, it will not let me past the updated JAR over the existing JAR since it's in Program Files. In Windows, installers seem to validate themselves, and in OS X, installers prompt you for the administrative password. Is there a way to validate Java to allow it to write to Program Files (or the Applications folder in OS X)?


That is not "64-bit" dependent. That has been that way on NT and on every Windows system since Vista.

Still, it only ever happened on 64-bit Windows 7. I ran my application, from Program Files, just fine on Windows XP, ME, Vista, and 7 (32-bit). It wasn't until I installed it on 64-bit Windows 7 that it refused to let me create data files in Program Files (and, strangely, never threw an exception fit about it, it just refused silently). Regardless, putting the files in the user's home directory fixed this issue. The problem is now with the updater, and I'm having little success elevating the permissions of Updater.jar.

Your users may need to run your program as administrator.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.