I created a standard Java Project in Eclipse, placed a XML file in the src
folder with the intent to grab it by Class#getResourceAsStream()
, 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 ending up in the /bin
folder during the build, but all in vain.
How is this caused and how can I solve it? I'm using Eclipse Galileo with build id 20090920-1017.
Clicking on the File menu and selecting New → XML File or.
To open XML files in the default editor: In the DITA CMS Eclipse Client, click Window > Preferences. In the left pane, click DITA CMS > General Behavior. Clear the Open unlocked document in Read-only Editor checkbox.
Invoke New XML File wizard using workbench menu File>New>Other>XML>XML. On the XML File Name page select a project or folder to contain the XML file and type a name for it. Next, select the option to Create XML file from an XML template.
This sounds vaguely familiar. Go to Prefs -> Java -> Compiler -> Building -> Output Folder, and make sure the "filtered resources" field doesn't include XML files. Also check the project-specific preferences.
I seem to recall that older versions of Eclipse had this in by default, but I'm not sure why it'd happen with a newer version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With