tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Caramarin" <>
Subject Re: jar files and gifs
Date Sat, 10 Nov 2001 06:33:23 GMT

    Sorry for confusing you, I was talking about an java application, not a
 Anyway thank you very much


----- Original Message -----
From: "Antonio W. Lagnada" <>
To: "Tomcat User" <>
Sent: 08 November, 2001 06:22 PM
Subject: Re: jar files and gifs

Is this a java/java swing app or a servlet/jsp?  I am confused since this is
a tomcat user mail group.

Anyways, if it is a java app, one example would be (if you are using
ImageIcon or other classes that supports URL in their constructor):

URL imageURL =
ImageIcon imageIcon = new ImageIcon(imageURL);

If this is a JSP/Servlet question, one approach is to create some image
factory that reads the image.  This image factory will then convert the
image into byte streams so the web browser would be able to display it.

** Note that the above example assumes that it is located on the root of the
jar file, not in a folder hierarchy somewhere.
You may need to use getResource("images/Myimage.gif").  I don't know if this

If you have a servlet that returns a bytestream give the gif file name, ie

You would be able to utilize this in html/jsp as:

<image src="http://localhost:8080/ImageService?imageName=MyImage.gif">

You will also have to load the image via the URL.openConnection(), etc...

----- Original Message -----
From: Adrian Caramarin
Sent: Thursday, November 08, 2001 6:09 AM
Subject: jar files and gifs


    I have a jar file, which contains some java .class files and two
directories /images and /sounds. The problem is when I run the jar file, the
images from it are not found. So, on the screen I don't see any gif.
    Could anyone tell me how could I access the gifs files from the jar
archive ?

Many thanks,
AdrianGet more from the Web.  FREE MSN Explorer download :

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message