I had a little quicky project in mind, I created a normal Java Project in Eclipse, placed a XML file quick'n'dirty in the src
folder and I was baffled when Eclipse can't seem to locate the XML file in the classpath. After a little test it turns out that files with other extensions are perfectly located.
Here's a screen which says it all:
It prints null
for the /test.xml
resource. The Class#getResourceAsStream()
obviously doesn't make any difference.
I checked the project's /bin
folder and the XML file is indeed not there. I've checked all settings to see if there isn't some filter to exclude certain files from taking in the /bin
folder, but all in vain. The only way to get it to locate the XML file is to externalize the file outside the project on the local disk file system and adding its path as "External Class Folder" in the project's build path.
I've never seen this before, but I can also not remember that I ever used this way to locate the XML files, they're normally already in an "External Class Folder".
Any suggestions? I'm using Eclipse Galileo with build id 20090920-1017. By the way, I don't need to get it fixed as-is, externalizing it is also OK, but I'd like to know how and why this would happen :)