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:

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
Post a Comment