Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 28th, 2006, 11:41 AM
monahan_ky monahan_ky is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 8 monahan_ky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 44 sec
Reputation Power: 0
Path to file in JAR

Hi,

I've got xml files in my source folder which I want to add to a JAR file. However when I added them to the JAR and put add the JAR to the build path, the paths which previous pointed to these files now throw "file not found" exceptions. Therefore the path that throws the error is

url="/WEB-INF/src/definition.xml"

I'm just wondering what should I change the path to so that it can reference my xml file in the JAR

Thanking you in advance

Mike

Reply With Quote
  #2  
Old February 28th, 2006, 04:35 PM
KhalidAli KhalidAli is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 100 KhalidAli User rank is Corporal (100 - 500 Reputation Level)KhalidAli User rank is Corporal (100 - 500 Reputation Level)KhalidAli User rank is Corporal (100 - 500 Reputation Level)KhalidAli User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 3 h 13 m 4 sec
Reputation Power: 11
how are you trying to access the file?

Reply With Quote
  #3  
Old March 1st, 2006, 12:21 AM
Rhemz's Avatar
Rhemz Rhemz is offline
Indeed.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: D.C.
Posts: 295 Rhemz User rank is Lance Corporal (50 - 100 Reputation Level)Rhemz User rank is Lance Corporal (50 - 100 Reputation Level)Rhemz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 22 h 57 m 29 sec
Reputation Power: 11
Send a message via AIM to Rhemz
To access a file inside a JAR, you need to create a URL, like so:

Code:
URL yourURL = Classname.class.getResource("path/to/your/file.xml");

Last edited by Rambone : March 1st, 2006 at 07:44 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Path to file in JAR

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap