tomcat-users mailing list archives

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

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

Sincerely,
Adrian

----- Original Message -----
From: "Antonio W. Lagnada" <nfets@msn.com>
To: "Tomcat User" <tomcat-user@jakarta.apache.org>
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 =
System.getClass().getClassLoader().getResource("MyImage.gif");
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
works.

If you have a servlet that returns a bytestream give the gif file name, ie
http://localhost:8080/ImageService?imageName=MyImage.gif

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
To: tomcat-user@jakarta.apache.org
Subject: jar files and gifs

Hello,

    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 :
http://explorer.msn.com



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message