This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Strange issue with getResourceAsStream()
- From: "Steve D. Perkins" <steve at steveperkins dot net>
- To: java at gcc dot gnu dot org
- Date: Wed, 02 Jul 2003 00:15:39 -0400
- Subject: Strange issue with getResourceAsStream()
I'm working with a GCJ natively-compiled Java application using SWT for
its GUI. I'm setting the icon for the top-level window using a small
bitmap file. SWT pulls this in as an InputStream, in my experimentation
I have tried both getResourceAsStream() and getSystemResourceAsStream()
to generate an InputStream for this bitmap. Below is the behavior I'm
finding:
- When I compile my application to a plain class file and run it with
the JVM interpreter, the application has no problem finding the bitmap
file and setting the window icon accordingly. Everything works fine in
this scenerio.
- When I use GCJ's "--resource" flag to compile the bitmap into an
object, and then link that object with my Java to form a standalone
executable, things do not work. I'm getting
"org.eclipse.swt.SWTException: Unsupported or unrecognized format".
- This does NOT mean that the application is unable to find the bitmap
at runtime! I've done other experiments where I bundle up a text file,
then read in that file and ouput it inside of my application. This
works fine. For some reason, bitmap data is apparently corrupted
somehow during this process.
Has anyone seen this before, is it a known issue of some kind? My
first hunch is that something different needs to be done for compiling
binary resources rather than ASCII ones, but I've found nothing about
this in my searches through the mailing list archives.
Steve