create a file at a Windows Vista using java applets
I have created a java applet which is downloaded to create local file at a Windows Vista PC. The java codes are:
File out = new File("c:/users/test/hkuesd.properties");
FileWriter fw = new FileWriter(out);
PrintWriter pw = new PrintWriter(fw, true);
pw.println("#sample property file");
pw.println("key_path=C:/");
pw.close();
fw.close();
If I turn off "Users Account Control" under "Control Panel" --> "User Accounts", the file "hkuesd.properties" is created at c:\users\test and can be found using windows explorer.
However, if I turn on "Users Account Control", I can not find the file "hkuesd.properties" using windows explorer. But the file can be detected if I run another java applet program with the following codes:
File xpdir = new File("c:/users/test/hkuesd.properties");
FileInputStream fis = null;
if (xpdir.exists()) {
try {
fis = new FileInputStream("c:/users/test/hkuesd.properties");
Properties p = new Properties();
p.load(fis);
fis.close();
privateKeyPath = p.getProperty("key_path", "no value");
}
catch (Exception e) {}
}
Interestingly, if "Users Account Control" is on and I created the file "c:\users\test\hkuesd.properties" manually, the file creation codes
mentioned above seems to create another "hkuesd.properties" at the same "c:\users\test". The evidence is I run the second java applet program which can detect the one created by the first java applet but not the one I created manually.

