This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Reading files located in runme.jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Reading files located in runme.jar" Watch "Reading files located in runme.jar" New topic

Reading files located in runme.jar

Jens E. Thomsen

Joined: Feb 16, 2007
Posts: 4

I have encountered a problem while running my runme.jar file. I have a User Help.txt file that is loaded by the client at startup. The file is loaded correctly when running the application from my IDE, but when I run my runme.jar, then the client can't find the file. I have verified that the file exist in the jar file. I have the same problem with the file.

Anyone have an idea of what the problem is and how to solve it?


Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Perhaps a good read of Roedy Green's notes on Jar files will help answer your question.

Look for Class.getResourceAsStream.
[ February 17, 2007: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Jens E. Thomsen

Joined: Feb 16, 2007
Posts: 4
Thanks for the answer. I will have a look at the links you posted.

Jens Erik
I agree. Here's the link:
subject: Reading files located in runme.jar
jQuery in Action, 3rd edition