Thanks for your response Burt.
It is in the same package but I'm beginning to think the file isn't
being copied correctly. Well at least for tests it isn't. Using intellij
or stopping grails test-app before it deletes
~/.grails/1.1.1/projects/ach/classes I can confirm that my file isn't there.
Do I have to add it as a resource to be copied or something?
Stan
Burt Beckwith wrote:
> If it's in the same package as your class, then it'd be
>
>
> String contents = getClass().getResourceAsStream('MyFile.txt').text
>
>
> Burt
>
>
> On Thursday 02 July 2009 10:26:33 pm Stan Carney wrote:
> > Has anybody loaded files off the classpath in Grails before?
> >
> > In Java I'm used to doing something like this:
> >
> > file: com/blah/MyFile.txt
> >
> > package com.blah
> >
> > public class MyClass(){
> >
> > public void someting(){
> > URL url = MyClass.class.getResource("/com/blah/MyFile.txt")
> > }
> > }
> >
> >
> > Similar code in grails always returns null. I have tried
> > getResourceAsStream, copying the file to the root of the project,
> etc...
> > They all still return null.
> >
> > Thoughts?
> >
> > Stan
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email