TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

files



Here is my code, I am trying to create a new file and write it to a
specific diretory and am getting file

java.io.FileNotFoundException: /home/es/java/filename.htm (Permission
denied)
 at java.io.FileOutputStream.open(Native Method)
 at java.io.FileOutputStream.<init>(FileOutputStream.java:98)
 at java.io.FileOutputStream.<init>(FileOutputStream.java:58)
 at java.io.FileOutputStream.<init>(FileOutputStream.java:128)
java.io.FileNotFoundException: /home/es/java/phrase_word1.htm
(Permission denied)
 at java.io.FileOutputStream.open(Native Method)
 at java.io.FileOutputStream.<init>(FileOutputStream.java:98)
 at java.io.FileOutputStream.<init>(FileOutputStream.java:58)
 at java.io.FileOutputStream.<init>(FileOutputStream.java:128)

/home/es/java is wide open, 777. why would I be getting a permission
denied? Here is my code:

        public static void writeToFile(String url2) {

                String url = replacePlus(url2);

                String outputFile = "filename.htm";

                try {

                        File out = new File("/home/es/java", outputFile
);
                        FileOutputStream stream = new
FileOutputStream(out);
                        DataOutputStream writeOut = new
DataOutputStream( stream );
                        writeOut.writeBytes(url);
                }
                catch ( IOException ioex ) {
                        System.out.print("Problem with file" );
                        ioex.printStackTrace();
                }

        } // end of writeUrltoFile

Thanks, and BTW that other result set thing got fixed, all I did need
was a res.next() to set the pointer to the first record. Thanks for the
help.

Erick