On 4 July 2011 08:35, tanteanni <tantea...@hotmail.com> wrote:
> i need some files on sever side but the normal: put it in
> "resources"-Folder(i created one because webappcreator didn't) and use
> MyClass.class.getResourceAsStream("/" + "filename"); does not work?! i
> allways get null. usind FileInputStream and absolute path works.
> gwt-maven-plugin copies the file to target but it seems that it is not part
> of classpath?!
> what is the normal way to use resources on server side in a gwt/maven
> project?

GWT is mostly client side so I doubt it has anything to do with this problem.

Server side everything Java should work normally. Is this code in a
web app (i.e. a WAR)? Or standalone? If a WAR then note the difference
between src/main/resources and src/main/webapp. Check what ends up in
your WAR and where.

Also, if a WAR, you should use
Thread.currentThread().getContextClassLoader().getResourceAsStream()
or this.getClass().getResourceAsStream(). The leading slash might be
implied, i.e. the filename is treated as being absolute (I read that
somewhere, I haven't checked whether it's true).

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

Reply via email to