[Solved] Error java.lang.NullPointerException on a executable


You have an error in this class/line

jTMainMenu.java:786

Seems you tried to load a image in this point of your code, i don’t know how you are generating a executable from your java code but this may be the source of the problem. Try to put this image outside of your executable/jar and use a relative path to load the image, like ‘./my_image’.

You also have to take care if your user make a link to your executable, in this case a relative path can’t resolve your problem. A simple way to solve this in java is get the source code location.

getClass().getProtectionDomain().getCodeSource().getLocation();

And use this location to find your image.

0

solved Error java.lang.NullPointerException on a executable