You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Arto Pastinen <ar...@ofw.fi> on 2004/07/16 12:04:18 UTC

uberjar problem.

Hi!

I have defined some images in project.xml

<resources>
	<resource>
        	<directory>src/resources</directory>
        </resource>
</resources>

And i try to get them in code by following way:
new ImageIcon(ClassLoader.getSystemResource("icon.png"))

If i run "real" jar, then everything works fine, but if i run uberjar, i
get following stack:

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.codehaus.classworlds.boot.Bootstrapper.bootstrap(Bootstrapper.java:209)
        at
org.codehaus.classworlds.boot.Bootstrapper.main(Bootstrapper.java:116)
Caused by: java.lang.NullPointerException
        at javax.swing.ImageIcon.<init>(ImageIcon.java:138)

Ant hints??

Artsi


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: uberjar problem.

Posted by Arto Pastinen <ar...@ofw.fi>.
Yes i have also tried that.. but then i get:
        at
sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:112)
        at
sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:248)
        at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
        at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)

Is it possible that sun's ImageFetcher is broken?


pe, 2004-07-16 kello 13:16, Emmanuel Venisse kirjoitti:
> Try this :
> new ImageIcon(this.getClassLoader().getSystemResource("icon.png"))
> 
> With uberjar, you use the classworlds classloader and not the default
> classloader.
> 
> Emmanuel
> 
> ----- Original Message ----- 
> From: "Arto Pastinen" <ar...@ofw.fi>
> To: <us...@maven.apache.org>
> Sent: Friday, July 16, 2004 12:04 PM
> Subject: uberjar problem.
> 
> 
> > Hi!
> >
> > I have defined some images in project.xml
> >
> > <resources>
> > <resource>
> >         <directory>src/resources</directory>
> >         </resource>
> > </resources>
> >
> > And i try to get them in code by following way:
> > new ImageIcon(ClassLoader.getSystemResource("icon.png"))
> >
> > If i run "real" jar, then everything works fine, but if i run uberjar, i
> > get following stack:
> >
> > Exception in thread "main" java.lang.reflect.InvocationTargetException
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> >         at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:324)
> >         at
> >
> org.codehaus.classworlds.boot.Bootstrapper.bootstrap(Bootstrapper.java:209)
> >         at
> > org.codehaus.classworlds.boot.Bootstrapper.main(Bootstrapper.java:116)
> > Caused by: java.lang.NullPointerException
> >         at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
> >
> > Ant hints??
> >
> > Artsi
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: uberjar problem.

Posted by Emmanuel Venisse <em...@venisse.net>.
Try this :
new ImageIcon(this.getClassLoader().getSystemResource("icon.png"))

With uberjar, you use the classworlds classloader and not the default
classloader.

Emmanuel

----- Original Message ----- 
From: "Arto Pastinen" <ar...@ofw.fi>
To: <us...@maven.apache.org>
Sent: Friday, July 16, 2004 12:04 PM
Subject: uberjar problem.


> Hi!
>
> I have defined some images in project.xml
>
> <resources>
> <resource>
>         <directory>src/resources</directory>
>         </resource>
> </resources>
>
> And i try to get them in code by following way:
> new ImageIcon(ClassLoader.getSystemResource("icon.png"))
>
> If i run "real" jar, then everything works fine, but if i run uberjar, i
> get following stack:
>
> Exception in thread "main" java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
>         at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
>
org.codehaus.classworlds.boot.Bootstrapper.bootstrap(Bootstrapper.java:209)
>         at
> org.codehaus.classworlds.boot.Bootstrapper.main(Bootstrapper.java:116)
> Caused by: java.lang.NullPointerException
>         at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
>
> Ant hints??
>
> Artsi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org