• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

making a jar file of images

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I'm trying to make a jar file that only contains images, and although i can do it when i try to load the images in my application(stored in a different path) it rises an I/O exception:

IOException: java.io.FileNotFoundException: JAR entry aire_on.gif not found in c:\images\images.jar

But it does not make sense, since the jar file is created an the images are stored there. I'm not sure but maybe it is not allowed to make a Jar file that does not contain any class (only images).

Can anyone help me?
Thanks
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you access the files? Please, post your code!

Generally, it should be not a problem, to read files from a jar-file.

If you read the jars content via the classloader (getClass().getResource()), then you have to ensure, that the jar is on your classpath.

I know, this is maybe not a very usefull answer, but perhaps a point of starting for you.

Post your code and we can help you with your special problem.

stefan
[ April 14, 2005: Message edited by: Stefan Willi ]
 
Stefan Willi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here are a small example:

Assuming, your jar in on classpath and include a file named "links.jpg".

Stefan
 
yo misma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks but I want to access a jar file in the C:/ root path, not in the same path of my class
 
Stefan Willi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can add your jar to your classpath, then the location of your jar can be anywhere.

Stefan
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic