Resource loading takes place in the classpath, relative to the current package.
If /var/tmp/gameXbox/src/
is in your classpath, then:
ImageIO.read( ClassLoader.getSystemResource( "image/button1.png" ) );
However, usually the src
folder is not included in the classpath by IDEs. Try adding the image to the bin
folder.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…