//String s = nameOfFile
String filePath = System.getProperty("user.dir") + File.separator + ".." + File.separator + s;
File location = new File(filePath);
OutputStream print = new FileOutputStream(location);
print.write(contents.getBytes());
print.close();
Basically I want to put the file in the same directory as the program which is making it rather than within it so I cape up with the path "filePath" however whenever the OutputStream tries to write to it I get a security exception. Is their a known fix or better way to do this?