How to include images in a JAR
Hi,
I have a java application(stand alone) coded as net beans application.
When i build the file i got a JAR file in the dist folder. I can get the imges only if i placed the images in the dist folder. Is there any possible to embed all the images within the JAR file itself so that the application can be executed using a single JAR file.
Hoping your valuable comments
thanks and regards
Arun
Re: How to include images in a JAR
Google is your friend: Loading Images.
One can think effectively only when one is willing to endure suspense and to undergo the trouble of searching...
J. Dewey
Re: How to include images in a JAR
yeah - make new directory such as image, or include them in JAR by setting up what types of files are included in JAR itself, there's setting in netbeans project options for that
Re: How to include images in a JAR
Quote:
Originally Posted by
2arunvr
Hi,
I have a java application(stand alone) coded as net beans application.
When i build the file i got a JAR file in the dist folder. I can get the imges only if i placed the images in the dist folder. Is there any possible to embed all the images within the JAR file itself so that the application can be executed using a single JAR file.
Hoping your valuable comments
thanks and regards
Arun
Create an images folder named images on the src folder and placed the images/icons onto there. After compiling you will get those images in the class folder .
You can access by the followings-
URL url = XLGamingCommonConstants.class.getResource("images/application-icon.gif");
Image image =Toolkit.getDefaultToolkit().getImage(url);
Thanks
Baruri