CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2014
    Posts
    15

    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?

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    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

  3. #3
    Join Date
    Sep 2014
    Posts
    15

    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

  4. #4
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    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
  •  





Click Here to Expand Forum to Full Width

Featured