508 compliance has never looked this goodThis is my brain..... in part, at least.

Thursday, December 13, 2007


You wait and see when the smoke clears
 
Lessons for the day (more for archival benefit than because you guys will be interested...):
  1. You can't use relative path names for images that you want to load from jars. You have to use a ClassLoader to getResource().
  2. It takes about 3 hours to determine this, if you forget that you can see the console output *if you run the jar from the command line* instead of trying to load it through Java WebStart.
  3. It takes about 10 minutes to fix this problem, thanks to Find/Replace.
  4. You cannot load files into a File object by their filename (even if you use getResource) if they are stored in a jar. Apparently, jarring them cause them to not be files any more (I know, it makes no sense to me either, but that's the best answer I could come up with from the forums). You need to use ClassLoader.getResourceAsStream() to put the jarred file directly into an input stream, skippign hte file object all together.
  5. It takes another three hours of [Run the program in Eclipse. See that it works. Jar the project. Sign the jar. Run the jar through WebStart. See that it's broken.] repeated, ad nauseum, and googling various variations on the theme of "jar read from file" before you remember that you can run the jar from the command line. And get the exception output, with the error name, and google that.
  6. It takes about 30 seconds to fix this problem, once you know how.

And, if you spend all day debugging all this stuff... you get no real quantifiable work accomplished.

Labels: , , , , , ,

posted by Deedee 4:02 PM
(2) comments