Results 1 to 3 of 3
  1. #1
    java_kick is offline Member
    Join Date
    Mar 2009
    Rep Power

    Default How to read xml file located in local system using Java


    I have one XML file in my local system. I am trying to read it in my project using this.getClass().getClassLoader() .getResourceAsStream(path), where the path is absolute path. But i am getting null as input stream.

    So, Could somebody help how to read xml file using java?

    Thanks in Advance,


  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Cambridge, UK
    Rep Power


    getResourceAsStream() uses a path relative to the current classpath. To get a general file, use and the various input streams and readers in that package.

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Rep Power


    For files with absolute paths (rather than relative to the classpath), just use FileInputStream.

Similar Threads

  1. How to read Excel file with java
    By chetan-24 in forum New To Java
    Replies: 6
    Last Post: 09-13-2014, 12:43 PM
  2. help to read .pst file through java
    By umadas in forum Advanced Java
    Replies: 2
    Last Post: 12-19-2010, 04:32 AM
  3. How to open a file located in server from client side
    By Malathi in forum Web Frameworks
    Replies: 4
    Last Post: 04-20-2009, 09:10 PM
  4. confusion
    By ankurdh in forum New To Java
    Replies: 5
    Last Post: 01-08-2009, 08:28 AM
  5. How to read a text file from a Java Archive File
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-08-2008, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts