I have created a ClientBundle as below.
public interface DataResources extends ClientBundle {
DataResources IMPL = (DataResources) GWT.create(DataResources.class);
@Source("marker.png")
ImageResource markerimage();
@Source("settings.png")
ImageResource settingsimage();
@Source("back.png")
ImageResource backimage();
}
I am getting an error that it cannot find the resources. I have all the images in the top level of my “war” directory.
00:00:04.302 [ERROR] Resource marker.png not found. Is the name specified as Class.getResource() would expect?
Data resources are referenced relative to the package (folder) your class is in. You can try moving the images in the same package to check if that works.
I would typically have my resource interface in a package – something like
com.project.resources. The images would then be incom.project.resources.images, and the Source annotations would take the form@Source("/images/marker.png").By following this package structure you can also bundle your resources/images in JARs and can include and reference them in other projects.