Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 26th, 2007, 04:44 AM
Registered User
 
Join Date: Jun 2006
Location: Chennai, TamilNadu, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old December 26th, 2007, 05:03 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #3 (permalink)  
Old December 26th, 2007, 05:52 AM
Registered User
 
Join Date: Jun 2006
Location: Chennai, TamilNadu, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with PHP file reading XML file for output rydog65 Beginning PHP 0 March 26th, 2008 05:13 PM
reading a XML file connect2sandep XML 1 December 14th, 2006 04:50 AM
reading a XML file connect2sandep General .NET 0 December 13th, 2006 02:10 PM
Accessing properties file outside jar file anand_indya J2EE 0 December 8th, 2004 06:34 AM
Read XML Config File From Within EJB JAR leojhartiv J2EE 0 October 6th, 2003 03:08 PM



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


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