A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Retrieving URL using getResource
Joined: Jun 29, 2008
Jan 22, 2010 00:17:45
In my project i need to retrieve the url to a resource(xml file ) in one
project from another project ,two project are in the same work space.
i tried the same when the resource is in the same project that is working but when the resource is in a different project its not working and the url is coming as null.
please find the piece of code i used for getting the url
URL mUrl = XMLParser.class.getResource("/Santhosh.xml");
SCJP 1.4,SCWCD5, SCBCD5
Joined: Sep 27, 2006
Jan 29, 2010 08:16:47
When the resource in another project, it is not in classpath.
So try adding project dependency( assumed you are using eclipse by the usage of term workspace)
Properties --> Java build path-> projects
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Retrieving URL using getResource
Forwarding request to same servlet
Configuration of filter problem
OutputStream writing and SSL
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013