0

Okai so I have a jfilechooser
:

JFileChooser chooser = new JFileChooser();
int returnName = chooser.showOpenDialog(null);

            if (returnName == JFileChooser.APPROVE_OPTION) {
                 f = chooser.getSelectedFile();
                if (f != null) { // Make sure the user didn't choose a directory.

                    path = f.getAbsolutePath();//get the absolute path to selected file
                    //below line to test the file chooser
                    //System.out.println(path);
                }

                System.out.println (path);

so now the path is c:\fa\sdf\asdf\sfd\sadf\fsaf.txt

But I want this path to go into this:

BufferedReader in = new BufferedReader(
new FileReader(
"path"));

But its not working ?????

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Patil Raj
0

Hi, infact the path name should not contain back slash but forward slash, what i mean is / instead of \

try replace c:\fa\sdf\asdf\sfd\sadf\fsaf.txt
with c:/fa/sdf/asdf/sfd/sadf/fsaf.txt

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.