Don't do that. When you'll create a jar you won't have access to that file as a File
object but as an URL
from which you'll have to get the InputStream
with openStream()
.
Instead, use the Scanner(InputStream)
with:
try (InputStream is = getClass().getResource("/Menus/CharSelect/Unlocked.txt").openStream()) {
scanner = new Scanner(is);
...
} // is.close() called automatically by try-with-resource block (since Java 7)