Manish Pandit wrote:
>> You can put the XML file anywhere in the classpath, and then use:
>>
>> getClass().getResourceAsStream("/params.xml") which will return the
>> InputStream to params.xml, that can be passed to the build() method.
> Thanks for the answer. I've tried that and it works... only if the
> file is in one of the folders in the JVM classpath and that's really
[quoted text clipped - 6 lines]
> request.getPathTranslated() function and use the resulting path to
> open my file, but the damn thing won't work and always returns null!!!
What's wrong with using the application-specific part of the classpath for the
application-specific files?

Signature
Lew
DBoy001 - 05 Dec 2007 15:40 GMT
> Manish Pandit wrote:
> >> You can put the XML file anywhere in the classpath, and then use:
[quoted text clipped - 19 lines]
>
> - Afficher le texte des messages précédents -
It wouldn't be wrong, but it doesn't work... I tested different
locations and it'll only work with the directories that are on the JVM
classpath (I wasn't clear on that part, sorry)...
ANYWAYYYY, I found a solution for getting my getPathTranslated,
"manually" translated... here it goes :
String xmlFileWithPath =
this.pageContext.getServletContext().getRealPath(request.getServletPath());
xmlFileWithPath = xmlFileWithPath.substring(0,
xmlFileWithPath.lastIndexOf("\\"));
xmlFileWithPath = xmlFileWithPath + "\\menu.xml";
SAXBuilder sxb = new SAXBuilder();
Document xmlDocument = sxb.build(new
File(xmlFileWithPath));
Thanks for your help!
Lew - 05 Dec 2007 19:16 GMT
Lew wrote:
>> What's wrong with using the application-specific part of the classpath for the
>> application-specific files?
> It wouldn't be wrong, but it doesn't work... I tested different
> locations and it'll only work with the directories that are on the JVM
> classpath (I wasn't clear on that part, sorry)...
What locations did you test?
Is this a web application?
If so, did you put the JAR in WEB-INF/lib/?

Signature
Lew
this post contained three requests for information.
DBoy001 - 06 Dec 2007 15:55 GMT
> Lew wrote:
> >> What's wrong with using the application-specific part of the classpath for the
[quoted text clipped - 12 lines]
> Lew
> this post contained three requests for information.
No, it's not a java web application, it's a ColdFusion-hybrid
application that uses custom jsp tags and javabeans... so it's kind of
like all my webapps are actually sharing the same webapp space thus,
forcing me to identify their location... it's kind of bulsh**ty but
I'm stuck with that and trying to make something good out of it!
Anyway, the solution I put up here solves my problem perfectly so I'm
good, until next time :-)