Hi Igor,

The problem is that the resource annotation will only understand either:

1) A file name relative to the package. This must only be a file name, not a
path
2) A fully qualified path

The problem is that you're using a relative path for the file, which will
not work. You have to use the fully-qualified form, with forward slashes.

The fact that it works for Windows when using backslashes is an accident of
the implementation.


Rajeev

On Thu, May 14, 2009 at 12:46 PM, Igor Moochnick
<[email protected]>wrote:

>
> This is the error I'm getting on the Jetty (hosted) server when
> opening my application:
>
> [DEBUG] Loading an instance of module 'mymodule'
> [DEBUG] Rebinding com.mymodule.Myclient.Images
> [DEBUG] Invoking <generate-with
> class='com.google.gwt.user.rebind.ui.ImageBundleGenerator'/>
> [DEBUG] Analyzing method 'TopLeft' in type
> com.mymodule.Myclient.Images
> [ERROR] Unable to find image resource 'images/Dialogue_Corner.gif'
> [ERROR] Unable to load module entry point class com.mymodule.Myclient
> (see associated exception for details)
> [ERROR] Failure to load module 'mymodule'
> [ERROR] Deferred binding failed for 'com.mymodule.Myclient.Images';
> expect subsequent failures
>
> On May 4, 5:21 pm, Rajeev Dayal <[email protected]> wrote:
> > Actually, the documentation says that GWT uses
> ClassLoader.getResource(..)
> > to locate images. As a result, the syntax that you use in the annotation
> > *should* be OS-agnostic. You should always use forward slashes ( / ) to
> > separate path components.
> >
> > Is that not working for you?
> >
> > On Fri, May 1, 2009 at 6:20 PM, Igor Moochnick <[email protected]
> >wrote:
> >
> >
> >
> > > I have a relative path use in the @Resource attribute on my image
> > > bundle. Apparently the direction of the slashes are important and
> > > depend on what OS I'm building my project.
> >
> > > On Windows it has to be "\"  and on Linux - "/".
> >
> > >        public interface Images extends ImageBundle
> > >        {
> > >                @Resource("images/Dialogue_Corner.gif")
> > >                AbstractImagePrototype TopLeft();
> > >        }
> >
> > > The documentation mentions that the GWT uses System.getResource method
> > > to locate the images.
> >
> > > Any idea how to make it OS independent?
> >
> > > BWT: if the application written correctly on the Windows, it should
> > > pick the Linux slash "/" with no problem, but, apparently, Java
> > > getResource is not the case.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to