|
-
October 27th, 2014, 04:57 AM
#1
File not found exception
I am trying to implement an program that allows me to choose a file using JFileChooser, and parse the xml file using a SAX parser. I get the absolute path using: fc.getSelectedFile().getAbsolutePath(); And this gives me the right location of the file.
fileName = "\\users\udc8\a4471\My Documents\blockdiagram.xml"
However, when I try to run my parser it looks in the wrong Place.
parser.parse(fileName);
java.io.FileNotFoundException: \\users\udc8\a4471\workspace\SAX Intro\users\udc8\a4471\My Documents\blockdiagram.xml (The system cannot find the file specified)
Looking at that adress it adds the working directory. How does one change this?
-
October 27th, 2014, 06:58 AM
#2
Re: File not found exception
That's really strange that the parse() method would change the file path it received. Can you debug the parse() method to see why it does that?
Norm
-
October 27th, 2014, 07:29 AM
#3
Re: File not found exception
Well I Think the parse() method is preset to use the relative path and just want the file name as input. However I don't know how to change to the relative path if I have to go back a couple of folders to find the right path, and doing this no matter what's the location of the file. It all seems dumb to me not using the absolute path as a standard because Everything is so much easier going that way than the other.
The documentation I find is Oracles on XMLReader, doesn't say much.
Last edited by mikeymoo; October 27th, 2014 at 08:08 AM.
Reason: Couldn't paste link
-
October 29th, 2014, 07:32 AM
#4
Re: File not found exception
How does the API doc describe the args to the parse() method? Are you calling it correctly?
Also posted at: http://www.javaprogrammingforums.com...tml#post162008
Last edited by Norm; October 29th, 2014 at 07:39 AM.
Norm
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|