rj
2013-02-13 22:56:29
So I was messing around with file saving in java and came up with:
And I get this error:
I'm guessing im not using this correctly:
How would I save this to desktop?
Btw using:
Just saves it to a random folder lol
import java.io.*;
public class TestList {
public static void main(String[] args) throws IOException{
File f;
f=new File("C:\\testfilemake.doc");
//if(!f.exists()){
f.createNewFile();
BufferedWriter output = new BufferedWriter(new FileWriter(f));
output.write("TROLOLOLOL");
output.close();
}
}
//}And I get this error:
Exception in thread "main" java.io.IOException: Access is denied
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)
at TestList.main(TestList.java:9)
I'm guessing im not using this correctly:
f=new File("C:\\testfilemake.doc");
How would I save this to desktop?
Btw using:
f=new File("testfilemake.doc");
Just saves it to a random folder lol