java - Creating executable jar file that can display images from folder on desktop -


i'm trying make code can show images in gui folder on, let's say, desktop. problem need able chose images after extracting jar file , i, therefore, can't put images in scr folder before extracting jar file.

i tried didn't work since images not in project map.

// option 1  string string = "c:/users/remco/desktop/folder/" + listofnames[pointer];  // option 2  string string = system.getproperty("user.home") + "/desktop/folder/" + listofnames[pointer];   this.background_path = string; img = new imageicon(getclass().getresource(background_path)).getimage(); 

is there way avoid problem , import (and display) images?

thanks lot!


Comments