A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
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
I agree. Here's the link:
subject: Retrieving URL using getResource
OutputStream writing and SSL
Configuration of filter problem
Forwarding request to same servlet
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014