How to include text files with Executable Jar

Posted by Jake on Stack Overflow See other posts from Stack Overflow or by Jake
Published on 2010-04-20T00:31:37Z Indexed on 2010/04/20 0:33 UTC
Read the original article Hit count: 537

Filed under:
|
|
|

Hi guys rookie Java question.

I have a Java project and I want to include a text file with the executable jar. Right now the text file is in the default package.

InputFlatFile currentFile = new InputFlatFile("src/theFile.txt");

I grab the file with that line as you can see using src. However this doesn't work with the executable jar.

Can someone please let me know how to keep this file with the executable jar so someone using the program can just click a single icon and run the program.

Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about beginner