FileOutputStream access is denied : JAVA

You are trying to access the directory. The parameter of the FileOutputStream should be a File/ Path object pointing to a file:

 FileOutputStream file  = new FileOutputStream("path/file.txt");
                   File -------------------------------^

For more detail take a look on http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html


You need to have permission to access that file location. There are two possible solutions.

1. use deferent file location to store your file (eg: D:\\somewhere)  
2. make sure that you have permission to access current location by granting 
   read write permissions.