From: Fencer on
On 2010-01-29 04:11, Lew wrote:
> Fencer wrote:
>> Thanks for your reply, Lew, and you make a dood point. There are
>> several jar-files in my WebContent->WEB-INF->lib folder, but if I
>> put my XQuery file in there, getResourceAsStream() doesn't find it
>> :(
>>
>> If I could make it work without adding a directory to classpath
>> like I'm doing that would be even better!
>
> There are already several directories in your class path for a web
> app.
>
> Is your "XQuery file" a JAR? No? Then it doesn't go in the "lib/"
> directory.

No, it's a text file containing code written in the XQuery (an XML query
language), I should have detailed that better in my OP. That's why I
didn't put it in the lib directory (however, I did put the Saxon
jar-file there which I use for running XQuery).

>
> The root directory of your application ("application-name/") and the
> classes directory ("application-name/WEB-INF/classes/") are already
> in your path. Put your resource relative to one of those.
>

I can't check right now but I believe I already put the file in the
project root but I still couldn't load it. I will try again a little later.

Can I get runtime information on which directories are in the classpath?

- Fencer
From: Mike Schilling on
Fencer wrote:
> On 2010-01-29 04:11, Lew wrote:
>> Fencer wrote:
>>> Thanks for your reply, Lew, and you make a dood point. There are
>>> several jar-files in my WebContent->WEB-INF->lib folder, but if I
>>> put my XQuery file in there, getResourceAsStream() doesn't find it
>>> :(
>>>
>>> If I could make it work without adding a directory to classpath
>>> like I'm doing that would be even better!
>>
>> There are already several directories in your class path for a web
>> app.
>>
>> Is your "XQuery file" a JAR? No? Then it doesn't go in the "lib/"
>> directory.
>
> No, it's a text file containing code written in the XQuery (an XML
> query language), I should have detailed that better in my OP. That's
> why I didn't put it in the lib directory (however, I did put the
> Saxon
> jar-file there which I use for running XQuery).
>
>>
>> The root directory of your application ("application-name/") and
>> the
>> classes directory ("application-name/WEB-INF/classes/") are
>> already
>> in your path. Put your resource relative to one of those.
>>
>
> I can't check right now but I believe I already put the file in the
> project root but I still couldn't load it. I will try again a little
> later.

I don't think the project root is in the classpath. The normal wasy
to make a resource available is

1. Put it below WEB-INF/classes, e.g. a resource named a/b/c.xml would
go at WEB-INF/classes/a/b/c.xml
2. Put it into a jar file, and put the jar file into WEB-INF/lib


From: Lew on
Mike Schilling wrote:
> I don't think the project root is in the classpath. The normal wasy
> to make a resource available is

Depends on which of the three types of 'getResource*' methods you use. Those
in 'javax.servlet.ServletContext' include the project root.

--
Lew
From: Mike Schilling on
Lew wrote:
> Mike Schilling wrote:
>> I don't think the project root is in the classpath. The normal
>> wasy
>> to make a resource available is
>
> Depends on which of the three types of 'getResource*' methods you
> use. Those in 'javax.servlet.ServletContext' include the project
> root.

That you need to call a method on a completely different class is a
critical bit of information to omit. And it remains true that the
project root is not in the classpath.


From: John B. Matthews on
In article <hjuome$p2l$1(a)news.albasani.net>, Lew <noone(a)lewscanon.com>
wrote:

> Mike Schilling wrote:
> > I don't think the project root is in the classpath. The normal wasy
> > to make a resource available is
>
> Depends on which of the three types of 'getResource*' methods you use. Those
> in 'javax.servlet.ServletContext' include the project root.

In this context, does "three types" mean those "getResource*" methods
found in java.lang, java.beans.beancontext, and javax.servlet?

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>