The first one should work, you just have to make sure there is a top level folder 'images' in the jar file with the ts.png file in it. (This assumes you are using
Java 1.3 or later as that's when png support was introduced)
If the images are in a rar file (a guess from your second piece of code) you will need to extract them and place them in an images folder before building the jar.