Re: Executable Jar file reading files.

Discussion in 'Java' started by Alan Gutierrez, Mar 31, 2009.

  1. On Mar 31, 3:27 pm, Alan Gutierrez <> wrote:
    > On Mar 31, 3:03 pm, Bojan <> wrote:
    > >
    > > On Mar 31, 3:34 pm, Alan Gutierrez <> wrote:

    >
    > > > On Mar 31, 2:19 pm, Bojan <> wrote:

    >
    > > > > BufferedReader br = new BufferedReader(new FileReader("Resources/
    > > > > header-script.html"));


    > > I am sorry but I do not understand what you are talking about.  The
    > > files are already included in the JAR and it does not work.  I do not
    > > understand what u mean by Class.getResource(String resourceName).  Can
    > > you please explain with the file header-script.html that is in
    > > Resources folder, that needs be obtained as BufferedReader br in a
    > > class that is in folder JavaClasses.


    > BufferedReader reader =
    >   new BufferedReader(new InputStreamReader(
    >     getClass().getResourceAsStream("Resources/header-script.html")));
    >
    > Alan Gutierrez


    Oops. Meant to say "/Resources/header-script.html" so that resource
    would not be sought relative to the class file.

    Alan Gutierrez
    Alan Gutierrez, Mar 31, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    555
    Arnold Peters
    Jan 5, 2005
  2. Replies:
    3
    Views:
    1,495
    Malte
    Mar 9, 2005
  3. kamal
    Replies:
    0
    Views:
    403
    kamal
    Mar 10, 2005
  4. Jason Cavett
    Replies:
    8
    Views:
    609
    Sanjay
    May 16, 2007
  5. Bojan
    Replies:
    7
    Views:
    3,492
    Arne Vajhøj
    Apr 3, 2009
Loading...

Share This Page