r/CircleProgramming • u/Illuminatesfolly • Jul 19 '13
Guise. Help
So, it's well known that JARs and the IDEs that make them handle classpaths a little differently.
So, how do I fix the null pointer exception given to me when I attempt to load the configfile for a frame for code like this:
>String ConfigFile = this.getClass().getClassLoader().getResource(".").getPath().concat("ConfigFile.txt");
This code works fine through the IDE but does not work at all in the JAR. Wut do?
6
Upvotes
View all comments
Show parent comment
3
u/Illuminatesfolly Jul 20 '13
In the same directory as the source, but this is the path that is meant to create the configfile -- that's why it is concatenating the final "ConfigFile.txt".
It is supposed to get the location of the program and save the configfile there.