Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24
  1. #21
    pj6444 is offline Senior Member
    Join Date
    Jan 2013
    Posts
    164
    Rep Power
    2

    Default Re: Files in exported jar not being accessed?

    Ok, so I changed it to a getResource() instead of getResourceAsStream() and it somehow worked.

    Thank you both for the help!

  2. #22
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Files in exported jar not being accessed?

    Quote Originally Posted by pj6444 View Post
    Ok, so I changed it to a getResource() instead of getResourceAsStream() and it somehow worked.

    Thank you both for the help!
    Okay, I should have looked at the API. getAudioInputStream seemingly requires a URL, and not a Stream. Oh, well, you got it, anyway. Ignore the earlier options listed, as I didn't bother to look at the API and assumed (from the code posted) that getAudioInputStream needed an InputStream and not a URL. Judging from the stacktrace, however, it is able to take either or, but from out of a jarfile it seemingly must be the URL, only.

  3. #23
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default Re: Files in exported jar not being accessed?

    I'm so curious what the value of variable 's' is (used as a path name of a resource) ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #24
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Files in exported jar not being accessed?

    Quote Originally Posted by masijade View Post
    Okay, I should have looked at the API. getAudioInputStream seemingly requires a URL, and not a Stream. Oh, well, you got it, anyway. Ignore the earlier options listed, as I didn't bother to look at the API and assumed (from the code posted) that getAudioInputStream needed an InputStream and not a URL. Judging from the stacktrace, however, it is able to take either or, but from out of a jarfile it seemingly must be the URL, only.
    There are several getAudioInputStream methods.
    The one using the InputStream requires (as it says in the documentation) that the stream allows mark and reset.
    The others (the one using File and the one using a URL) presumably use a form of InputStream internal to the AudioSystem, which obviously would allow mark and reset.
    There is (I believe) an overhead involved with creating a stream that can be reset, which is presumably why the base ResourceAsStream does not do it.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 06-21-2013, 06:21 PM
  2. Question about using icons in exported jar
    By dc495 in forum Advanced Java
    Replies: 0
    Last Post: 11-08-2012, 04:15 PM
  3. Replies: 0
    Last Post: 04-10-2012, 02:21 PM
  4. Reference an array so it can be accessed
    By DGates in forum New To Java
    Replies: 5
    Last Post: 02-06-2012, 09:12 PM
  5. Probelms with the ConnectorJ and exported JAR
    By Smokin' Caterpillar in forum JDBC
    Replies: 5
    Last Post: 10-18-2010, 10:26 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
  •