views:

50

answers:

3
+2  A: 

Your name looks wrong - incorrect extension and the wrong kind of slash:

private static final String ENDINGS_FILE_NAME = "res/endingRule.txt";
Jon Skeet
sorry, I fixed code. endingRule.txt
Victoria
If was double slash
Victoria
@Victoria: I don't think it was the lack of a leading slash that was the problem, if you're *genuinely* calling `getClassLoader().getResourceAsStream()` rather than just `getClass().getResourceAsStream()`.
Jon Skeet
+2  A: 

To retrieve the file inside the jar, use:

private static final String ENDINGS_FILE_NAME = "/res/endingRule.txt";
...
InputStream is = getClass( ).getResourceAsStream(ENDINGS_FILE_NAME);
Paulo Guedes
That shouldn't be necessary when using `getClassLoader().getResourceAsStream()` though - that wouldn't require a leading slash.
Jon Skeet
+1  A: 

The \ is being interpreted as an escape character rather than directory separator. File name is also off. Try:

private static final String ENDINGS_FILE_NAME = "res/endingRule.txt";
unhillbilly
If was double slash
Victoria