Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] loading images from jar under wince

How do I load images under wince when the application is deployed in a jar file, together with the images ?

I wrote an application displaying some data together with icons in a table. I packaged everything including the gifs for the icons into a jar and it works fine under linux/X86.

When I transfer the jar to my iPaq running WinCe 3.0 I get an exception like:
"exeception .. at org.eclipse.swt.graphics.Image.init()"

(So I assume the images cannot be found.)

directory structure within jar :
/com/stoefer/astro/SWTTable.class (and other classes)
/com/stoefer/astro/gif/aries.gif (and other gifs)

shortcut on iPaq running wince:
"43#"\Programme\Java\bin\pjava.exe" -classpath \Programme\Java\swt.jar;\Programme\Java\test01.jar com.stoefer.astro.SWTTable"
(everything on one line off course)

code snippet from the part of SWTTable.java loading the images:

" String location;
String[] names = {"aries","taurus","twin","cancer",
   "lion","virgin","libra","scorpio","sagittarius",
    "capricorn","aquarius","pisces"};
for (int i=0; i<12; i++) {
  location = "/com/stoefer/astro/gif/"+names[i]+".gif";
  InputStream iconStream = this.getClass()
     .getResourceAsStream(location);
  images[i] = new Image(display, iconStream);
}"

(the swt - dll for wince is in the /lib directory of the sun java vm I am using).





Back to the top