Results 1 to 4 of 4
  1. #1
    TimHuey is offline Member
    Join Date
    Aug 2009
    Posts
    50
    Rep Power
    0

    Default Jar file has Data file in it...How do I get to it?

    I misposted this in the NetBeans section thinking it was a netbeans issue but I believe it's more related to Java Web Start and directory nomenclature.

    when I do this:

    Java Code:
    InputStream is = resourceMap.getClassLoader().getResourceAsStream(" bidit" + System.getProperty("file.separator") + "resources" + System.getProperty("file.separator") + "Eqps.txt");
    The program will run using the jar file. However, when I use Java Web Start it can't find the file. If I do this:

    Java Code:
    InputStream is = resourceMap.getClassLoader().getResourceAsStream(" bidit/resources/Eqps.txt");
    it works both with java web start and the jar execution. But with the above example, I'm afraid it might not work on non windows directory structures such as Mac and linux. Anyone know if that would work above or why the top method doesn't work in javawebstart and does in the jar?

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

    Default

    Read the API docs for getResource and getResourceAsStream, again. Those methods do not use the "system filepath separator". I am amazed that the first example ever "worked" on either Windows or Mac (if you're claiming that) as it definately should not have "worked".

  3. #3
    TimHuey is offline Member
    Join Date
    Aug 2009
    Posts
    50
    Rep Power
    0

    Default

    Yeah, it worked. Repeatedly. Hmmm! Like I said in another thread. Sometimes JAVA is MAGICAL and WONDERFUL....sometimes not so much.

    BUT to your suggestion, I am hunting down this API you speak of. I keep meaning to do it but just haven't got around to it. A lot of people speak very highly of it. I'm very excited about getting my hands on one and expecting great things!

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

Similar Threads

  1. Replies: 9
    Last Post: 09-15-2009, 04:26 AM
  2. Reading data to file
    By puk284 in forum Advanced Java
    Replies: 1
    Last Post: 04-28-2009, 03:19 PM
  3. getting data from a file
    By sugard in forum Advanced Java
    Replies: 2
    Last Post: 03-03-2009, 07:24 AM
  4. Replies: 0
    Last Post: 02-11-2009, 09:53 AM
  5. Data Sorting in a .data file using java
    By stutiger99 in forum New To Java
    Replies: 2
    Last Post: 10-08-2008, 02:52 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
  •