java - JAR file not running when adding images -
i having problems exporting pictures jar file , after browsing found sollution, doesn't seem working
try { //leftfoot = imageio.read(new file("resources/leftfoot.png")); //rightfoot = imageio.read(new file("resources/rightfoot.png")); url url = this.getclass().getresource("/resources/leftfoot.png"); leftfoot = imageio.read(url); url = this.getclass().getresource("/resources/rightfoot.png"); rightfoot = imageio.read(url); } catch (ioexception e) { e.printstacktrace(); } }
so, if try upload items first 2 lines(and comment following 4), main gui stuff runs in jar file images ar not shown. if other way round(the code above), no gui element works in jar file. have "resources" folder containing pictures both in "bin" folder , in main folder along bin,src,settings etc. cause read somewhere how supposed be, although not know why. leftfoot , rightfoot bufferedimage objects. tell me not working here?
Comments
Post a Comment