0

I have all the images stored inside webapp/resources folder:

|-src-
     |-client
...
|-webapp-
        |-resources
                   |-images
                          |abc.png

Inside client folder, I have following:

public interface Images extends ClientBundle {

    @Source( "abc.png" )
    ImageResource abcButton();
 ...
}

Obviously, this does not work. I am trying to reference the file abc.png file in my program. I tried by adding webapp/resources/images/ in buildpath, but that did not work.

I do not want to put images file inside src folder, so just looking for alternatives.

Nish
  • 137
  • 1
  • 10

2 Answers2

1

Here is a great answer that I used to solve this exact problem:

https://stackoverflow.com/a/3448699

Here Igor suggests creating an additional "resource" package and using @Source("relative_path_to_resource") to locate your resource.

Cheers! - my first SO answer :)

Community
  • 1
  • 1
0

You can try to specify relative path to your image from class file.

If interface is located somewhere in 'com/your/package' then path will be '../../../../../webapp/resources/images/abc.png'

thepun599
  • 150
  • 1
  • 7