Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » .class.getResource() returns wrong directory?
.class.getResource() returns wrong directory? [message #202175] Mon, 15 October 2007 02:49 Go to previous message
Eclipse User
Originally posted by: rvraaphorst.hotmail.com

Hi all,

I converted a maven project to a wst project, and it all seems to work.
Everything is deployed to
P:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\ tmp0\wtpwebapps
directory.
A hibernate.cfg.xml file is deployed to the the \HDD\WEB-INF\classes
subfolder.

But on running the app, the hibernate.cfg.xml file can not be found:

URL url = HibernatePlugin.class.getResource("/hibernate.cfg.properties ");
File file = new File(url.getFile());
if(!file.exists())
System.out.println("File not found at "+url.getFile());

the url results in:
C:\Documents%20and%20Settings\Ronald.LAPTOP.000\Local%20Sett ings\Temp\0-ROOT\WEB-INF\classes\hibernate.cfg.properties

But that directory doesn't exist at all! Even though the HibernatePlugin is
located in a subfolder of \HDD\WEB-INF\classes.

I'm clueless... Why does the getResource() method return a complete
different dir? Has this something to do with the 'running two tomcat
instances' bug?
Is this a PATH issue on my Windows XP laptop?

Eclipse Platform
Version: 3.3.0
Build id: I20070621-1340
WST version 1.0.2v200706120315

TIA
Ronald
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Call for EclipseCon 2008 submissions ... for Web Tools!
Next Topic:XML Form Editor using WTP's Structured Text Editor
Goto Forum:
  


Current Time: Tue Jun 18 02:57:56 EDT 2013

Powered by FUDForum. Page generated in 0.01650 seconds