🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.language
2 messages
2 total messages Started by Salvador Huertas Wed, 28 Dec 2005 10:16
Images in Jar Files
#347
Author: Salvador Huertas
Date: Wed, 28 Dec 2005 10:16
10 lines
1306 bytes
Hi friends,
I need include Images in a jar file, I included the files into the JBuilder
Project but when I rebuild the Jar Archive don't include the images. I don't
know if I must have another matter for do so.

My second question it's how must I read this image from the code of my
application java (what path and other related problems ...)

Thanks in advance!!
Salvador Huertas.
Re: Images in Jar Files
#349
Author: Paul Furbacher [TeamB]
Date: Thu, 29 Dec 2005 15:25
47 lines
2701 bytes
Salvador Huertas wrote:

> I need include Images in a jar file, I included the files into the
> JBuilder Project but when I rebuild the Jar Archive don't include
> the images. I don't know if I must have another matter for do so.

In some simple tests that I just did in making
an Application JAR, it seems as though there's a
bug in the Make and Rebuild project and archive
functions.  Even though the JPG extension was set
to "Copy" in the list in Project Properties >
Build > Resources, the single JPG I put in the
"src" folder would not copy to the "classes" folder
when making or rebuilding the project.  Nor would
it copy to the Application JAR when making or rebuilding
the archive, even though the node's Properties > Content
setting is "Include all classes and resources".

Only after selecting the <Project Source> node, and
rebuilding it and then rebuilding the archive did
the image file get copied to the archive.

> My second question it's how must I read this image from the code of
> my application java (what path and other related problems ...)

Assuming you are getting the image in a class
called "MyClass", you should be able to use

   MyClass.class.getResource("image.jpg")

(substitute your image's filename).


-- 


Paul Furbacher (TeamB)

   Save time, search the archives:
        http://info.borland.com/newsgroups/ngsearch.html

   Is it in Joi Ellis's Faq-O-Matic?
        http://www.visi.com/~gyles19/fom-serve/cache/1.html

   Finally, please send responses to the newsgroup only.
   That means, do not send email directly to me.
   Thank you.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads