java - Include text file in Eclipse JAR export? -


i using fileinputstream read file object. program able read text file when run in eclipse ide, not when run jar file.

i exporting jar file , not runnable jar file, , know text file included in jar file because extracted check.

this file structure looks like:
enter image description here

i suggest put learnaboutfonts.txt inside src folder(not inside package) , read file in source code following:

resource resource = new classpathxmlapplicationcontext().getresource("classpath:learnaboutfonts.txt"); inputstream = resource.getinputstream(); bufferedreader br = new bufferedreader(new inputstreamreader(is)); 

and can use br want use. happy coding.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -