How to include images in a JAR
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: How to include images in a JAR

  1. #1
    Join Date
    Nov 2008
    Posts
    1

    Thumbs up 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

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    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
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Oct 2008
    Posts
    77

    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

  4. #4
    Join Date
    Jul 2009
    Posts
    1

    Re: How to include images in a JAR

    Quote Originally Posted by 2arunvr View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center