How do i open a DTD file as a resource in a custom Java action

Hi, I have a DTD document that i want to bundle with my custom java class. In the java class i want to read the document, eg getResourceAsStream(). I've put the document in my java source folder, but at deployment time i can't load it. Any suggestions? Thanks!
2 answers

Resources within projects are to be placed inside the resources directory of the project. To obtain a reference to the specific file one can use Core.getConfiguration().getResourcesPath().

E.g.: I've placed mysettings.properites inside /resources. Then I can obtain a File using:

File myFile = new File(Core.getConfiguration().getResourcesPath() + File.separator + "");

From there you can also create a FileInputStream and read its contents.


Thanks Arjen. I solved it with a jar added to the userlib. In my case these were external DTDs and not property files, so it made sense to do that way. I will remember this approach when I want to load a file.