This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am using NetBeans 8 and it works great. I have successfully designed my first GUI program written by myself, but I ran into an annoying problem that makes me wanna smash my computer. I can run my program in NetBeans no problem, but after I build and attempt to run it it doesn't work.
I know what the problem is I just don't know how to fix it.
I access files that are outside of my jar file and usually in an IDE if you put the files in the same directory it operates file and you can access those files by simply typing in the file name, but if you attempt to do the same after it has been compiled I get an expected response of file not found which is my error catcher.
Now how can I make sure the files I am needing to access can always be found relative to where my jar file is?
What you are actually doing in your IDE is loading the files from the current working directory, not loading them from the same directory where the jar is located. So I recommend you continue to do that when you leave the cradle which your IDE is.
That means you should set your working directory before you run the jar. But as Jonas says, it's better to put the resources inside the jar as well as the code.