If it's working in NetBeans, you've probably got the "Working Directory" property set. To check, right click the project in NB, choose Properties, click the "Run" category. I'm betting that the Working Directory property is set to a specific directory. If not, NB would automatically set it to the project directory.
So, either way, when NB runs your JAR file for you, it passes the option "-Duser.dir=PathToWorkingDirectory".
So if you want to produce that same behavior from the command line, just use that option. For example:
java -Duser.dir=PathToWorkingDirectory -jar YourJarFileName.jar
Hope that helps!