Java writes files that Vista can’t find!

March 24, 2009
62 Views

Or so it seemed. I was installing Jedit to see if they had fixed any of its annoying gnats. (Side note: its on version 4.3pre16. If you have to release something 16 times before it’s considered done, face it, you need to adjust your release system).

The installer I’d almost always used was the Java one; it was pretty low impact. I chose my folder (c:\\program files\\jedit) and away it went. The java installer requires you to make your own start menu entry, so I went in explorer to find my folder… and it wasn’t there.

Now, I have “show hidden and system files” set, so I didn’t think that was it. And when I ran an Administrator Command Prompt and did a dir in my Program Files directory, nope, not there.

So, I reran the installer to make sure that indeed, I was putting the write name. This time, I did the browse to force it to pick the right directory… and my jaw dropped. The Java installer was showing the jedit directory already created! I alt-tabbed to my explorer, refreshed, no jedit; reran the dir, no jedit.

I installed this time in JeditAgain. Same thing. No presence in a dir or File Explorer window.


Or so it seemed. I was installing Jedit to see if they had fixed any of its annoying gnats. (Side note: its on version 4.3pre16. If you have to release something 16 times before it’s considered done, face it, you need to adjust your release system).

The installer I’d almost always used was the Java one; it was pretty low impact. I chose my folder (c:\\program files\\jedit) and away it went. The java installer requires you to make your own start menu entry, so I went in explorer to find my folder… and it wasn’t there.

Now, I have “show hidden and system files” set, so I didn’t think that was it. And when I ran an Administrator Command Prompt and did a dir in my Program Files directory, nope, not there.

So, I reran the installer to make sure that indeed, I was putting the write name. This time, I did the browse to force it to pick the right directory… and my jaw dropped. The Java installer was showing the jedit directory already created! I alt-tabbed to my explorer, refreshed, no jedit; reran the dir, no jedit.

I installed this time in JeditAgain. Same thing. No presence in a dir or File Explorer window.

This was strange. Time to search.

Someone at StackOverflow, the Yahoo! Answers for programmers, had nailed it.

Java File.canWrite() on Vista and super hidden files is where a guy showed how Java can write files that he can’t see, but Java can… And the answer is:

UAC again. Yes, fans, when User Access Control is on, the java app writes are redirected to C:\\Users\\\\AppData\\Local\\VirtualStore\\. The program doesn’t know the difference, but your real Program Files is not touched.

And when I went there… yep, all my versions of Jedit were there, and a bunch of other stuff besides. Whenever a program was writing to it’s own directory (uncompressing files, whatever), it was putting them in this VirtualStore area.

Yet another reason to really hate Vista. I know, it thinks its doing it for my own good… but jeez.

BTW, if you want to run a java jar as an admin, you need to run it from the administrator command prompt.


Link to original post