Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: [Q] How to add image files into Java project
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] How to add image files into Java project



Hi, I sorry my question might be answered in the past, but I don't know how to
search previous archive.
(I'd appreciate it if anyone tell me how to do it.)

I have a problem including gif files into my Java application.
I included them via "Project/Add Files..." and they appeared in the PB. But
when I built and ran my application, my application failed to locate the gif
files. I used gif files for toolbar button icons so that I had blank tool bar
buttons.

How can I add gif files into the OS X executable PB creates?

By default Project Builder will put .gif files added to a target in a bundle resource phase which will cause them to be copied to the Resources folder of a bundle target. That works in many cases, but for standard Java programs to find resources they need to go into the .jar archive. To do this go to the Files and Build phases panel of the Target editor and drag the .gif reference to the Java Archive Files build phase. During this build phase the hierarchy of files used to make the .jar archive is assembled, then the archive is constructed during the frameworks and libraries phase. There is a known problem that prevents resources in the Java Archive Files phase from going anywhere other than the root level of the package, so if a resource needs to be placed in a subfolder of the folder used to construct the .jar then a copy files phase should be added between the Java archive files phase and the frameworks and libraries phase.

ChristianM


References: 
 >[Q] How to add image files into Java project (From: "Young-Jin Lee" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.