I'll be brief: I'm developing a simple java application, and I want di distribute to people just a single jar file when it's done. The problem is that at the momen I have to carry a jpg together with the jar file.
Is there a way to pack the image within the jar? Or maybe I could convert the image to bytes and put it in a class?
Thanks
3 replies to this topic
#1
Posted 21 November 2010 - 03:21 AM
|
|
|
#2
Posted 21 November 2010 - 03:44 AM
There's no reason why you can't put an image in a jar-file.
If you put the image in the package before making the jar, it will be included.
(You could even put the image in manually, a jar-file is just a zip-file and you can open it with any zip-program, like 7-zip.)
If you put the image in the package before making the jar, it will be included.
(You could even put the image in manually, a jar-file is just a zip-file and you can open it with any zip-program, like 7-zip.)
#3
Posted 21 November 2010 - 04:03 AM
You can put it in the jar. But then you will need to change the way you access the image. Even if you've used relative paths in the code you'll need
ClassLoader.getResource()To get the source path i think. I find it really annoying and always try to avoid it :glare:
#4
Posted 21 November 2010 - 04:10 AM
Thanks guys :D
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









