Article View: borland.public.jbuilder.java.language
Article #17952Re: locating a GIF-file in a JAR
From: Hubert A. Klein Ikkink
Date: Thu, 03 Sep 1998 00:00
Date: Thu, 03 Sep 1998 00:00
28 lines
1326 bytes
1326 bytes
Hi Andreas,
you can the following method from the java.lang.Class class:
public URL getResource(String name)
So the complete statement will be: getImage(
getClass().getResource("imageName.gif") );
--
Groetjes,
Hubert A. Klein Ikkink, aka Mr.Haki
E-mail: hubertk@worldonline.nl
Website: www.drbob42.com/jbuilder
Andreas Lingnau wrote:
> I want to load a predefined image (*.gif) in a class. When I call
> getImage("name.gif") it works in the IDE but when I export my package to
> a JAR-file the image can't be found.
>
> How can I get the image in the JAR file? Is there a method wich gets the
> start directory of a application?
>
> --
>
> Andreas Lingnau
>
> lingnau@uni-duisburg.de
>
> Duisburg, Germany
Technical Details
Message-ID:
<35EEDBC2.2417AF7C@worldonline.nl>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<35EE5262.D1FC024@uni-duisburg.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,16ebbdacc77400eb X-Google-Attributes: gidf74b3,public From: "Hubert A. Klein Ikkink" <hubertk@worldonline.nl> Subject: Re: locating a GIF-file in a JAR Date: 1998/09/03 Message-ID: <35EEDBC2.2417AF7C@worldonline.nl> X-Deja-AN: 387563387 Content-Transfer-Encoding: 7bit References: <35EE5262.D1FC024@uni-duisburg.de> To: Andreas Lingnau <lingnau@uni-duisburg.de> Content-Type: text/plain; charset=us-ascii Organization: www.drbob42.com Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language