The Artima Developer Community
Sponsored Link

Java Answers Forum
Accesing Image inside a jar file

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Tanvir Hossain

Posts: 53
Nickname: tanvirtonu
Registered: Feb, 2006

Accesing Image inside a jar file Posted: Jan 5, 2008 11:14 AM
Reply to this message Reply
Advertisement
I used following command to create my jar file- Client.jar
" jar cvmf Config.txt Client.jar *.class lib image report"
Where lib is a folder which contains many other jar files, image is a folder which contains image and report is folder containing jasper report files.
Now my created jar file should have the following table of contents-
(I ve just used an example of my directory structure)
META-INF/MANIFEST.MF
MyMainClass.class
OtherClass.class
lib/MyLib1.j ar
lib/MyLib2.jar
image/MyImage1.jpg
image/MyImage2.jpg
report/report1.jasper
re port/report2.jasper

The content of my Config.txt file is-
Main-Class: frmClientLogIn
Created-By: Tanvir
Class-Path: lib/MyLib1.jar lib/MyLib2.jar

Now in my application I used the following code to get an image-
new utility().loadImage("./image/MyImage1.jpg" );

utility is a class which is in MyLib1.jar used to set a background picture of a frame and the picture is in image directory as u can see.
But I m not getting any image,report or classes in other jar files.But If I just put the image,report and lib folder outside Client.jar file, I mean-
Client.jar,lib,report and image in a directory, everything works well.How can I make a single jar putting my lib,image,report and other classes in a single jar file.
One more thing,instead of-
Class-Path: lib/MyLib1.jar lib/MyLib2.jar
can I do this-
Class-Path: lib/.jar*
But I t didnt work for me.Do I have to mention each jar file in a folder.
PLS HELP ME.

Topic: Accesing Image inside a jar file Previous Topic   Next Topic Topic: Links for source code

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use