/ Published in: Java
URL: http://www.java-tips.org/java-me-tips/midp/how-to-read-a-resource-from-a-jar-file.html
Found an easier way to read files from an executable jar than my other snippet.
The '/' is what tells java to go looking in the jar that's running instead of outside of it.
Expand |
Embed | Plain Text
Scanner scanner = new Scanner(getClass().getResourceAsStream("/" + path_to_file));
You need to login to post a comment.
