简体   繁体   中英

Accessing a .jpg file that is in a Jar

I have a question about accessing a.jpg file that is contained within a ant generated java jar file. My java project contains Java code and some.jpg files that I use. I want to be able to reference that.jpg file and be able to copy from jar to a directory.

Is there any way to that or do I always have to keep the jar outside of the jar file?

You can import the jar as a library into your project and access the resources directory or wherever you placed the JPG if you want to reference it directly from your project.

Jar files are just.zip's with a manifest. If you know where in the jar file the jpg is place, you just need to unzip the jar and copy the jpg to the desired location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM