質問

in my project, i am using a ClientBundle for my images used in the project. The images I would be using were already used by other non-gwt project, a Flex web application so these images are placed in a single directory found outside my gwt project.

hierarchy:

server
 - image
     - myimage.gif
 - gwtprojects
     - myproject
        - com.gwt.sample
           - CImageResource.java

In my CImageResource class:

@Source("../../../../../image/myimage.gif")
ImageResource myImage();

And gwt says "Resource file is missing".

How can i used the image in my ClientBundle class? As much as possible, I don't wanna copy the image i'm gonna use in my project folder if there's a way to access it.

役に立ちましたか?

解決

GWT loads everything from the classpath, so just put the image folder in the classpath and you can reference your myimage.gif with @Source("myimage.gif"), @Source("/myimage.gif") or @Source("../../../myimage.gif").

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top