
-----------------------------------
matt271
Wed Jun 17, 2009 5:46 pm

read file out of jar
-----------------------------------
in java how do u read a file out of its own jar?

say u made some program in netbeans and had netbeans package it into a jar for u, but u also have an image say "image.jpg"

how can i open it like File("image.jpg"); is its in the JAR file itself, not in the same dir as the jar file??

ty

-----------------------------------
rizzix
Wed Jun 17, 2009 7:19 pm

RE:read file out of jar
-----------------------------------
[Code]
import java.io.*;
import java.util.jar.*;
 .
 .
 .
Jar jar = new Jar("");
ZipEntry imgEntry = jar.getEntry("image.jpg");

InputStream in = jar.getInputStream(imgEntry);
[/code]
