p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   J2EE (http://p2p.wrox.com/forumdisplay.php?f=94)
-   -   Reading xml file which is in a JAR file (http://p2p.wrox.com/showthread.php?t=64809)

pradheepayyanar December 26th, 2007 04:44 AM

Reading xml file which is in a JAR file
 
i have a jar with class files and xml files in it. my application uses this jar and a particular class has a link to the xml. but while compiling, it shows path not found. the application couldnt read the xml file in the jar. how to set the path or read the xml file


XML file in JAR:
SQLMaps/admin/sample.xml [folder structure inside the jar file]


my application has a path like SQLMaps/admin/sample.xml

but how do we point to the xml file in the jar

Regards
Pradheep

C ya
PraDz

iamrakesh22 December 26th, 2007 05:03 AM

The class which tries to read the xml or has the url to the xml and the xml files are in the same directory then try by giving just the xml file name. i think it'll look in the current directory
OR
You can try by giving the complete path from the root package. Say you've the xml file in a directory com/abc/def/ghi.xml and the class which reads it is in package com.abc.def.JKL.java then try by giving the path /com/abc/def/ghi.xml.

Hope that solves your problem.

- Rakesh

pradheepayyanar December 26th, 2007 05:52 AM

thanks rakesh

but my question is

the jar file contains
sqlmaps/admin/sample.xml


i have an application which uses this jar. in my java file

the package structure of my application is
pack/com/abc/def/filename.java

in this file i have to read the xml file which is in the jar file. i use tomcat and the lib contains the JAR file.

while reading, i have specified as ./sqlmaps/admin/sample.xml

but it cudnt recognize the xml in the jar file




C ya
PraDz


All times are GMT -4. The time now is 08:53 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.