Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Referring to a resource in a jar file

807605Aug 1 2007 — edited Aug 2 2007
Hi everybody,
I'm creating a jar file with a text file in it, and my application needs to create an input stream that connects to the file. When I run this on my computer without jarring it, it works fine; the file is in a package called "viewer" and it initializes without a problem. When I export from Eclipse 3.2 into a jar file, though, I get a message when I try to run it that the system can't find the file, even though the path to the package is exactly the same and the package is contained in the jar. I'm not really sure if there's a way to make a self-contained program for this...does anyone know if there's a specific method for referring to a text file resource in a jar?

Thanks,
Jezzica85
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2007
Added on Aug 1 2007
5 comments
283 views