Ask Your Question

Revision history [back]

it run out that the method "getPath" gives an additional "\" at the beginning. Adding ".substring(1)" tot he "getPath" method fixed this by removing the first unwanted "\". check the line below. Make sure to put .substring to every getPath() method.

 String url1 = getClass().getResource("lena.png").getPath().substring(1);