I don't know about javascript, never used it, but in Java if you package images etc. in jar files then your code needs to do something like
java.net.URL img = this.getClass().getResource("myImages/image.jpg");
myPanel.add(new JLabel(new ImageIcon(img))...);
if it's un-jar'd then the relative link
URL img = new URL("myImages/image.jpg");
is fine. Do you need to do something similar?