993541 wrote:dunno Netbeans project structure at all but I'd sugest maven project structure wich is widely used: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
Is there a special place within Netbeans project structure that I can place such files?
Say if I try and load a file "somefile.xml" - where is it going to look first?I'ts going to look for it where you tell your program to.
I have a <default package> with my settings.xml in there. How can I reference this within my app?<tt>getClass().getResource("/settings.xml")</tt>
TPD Opitz-Consulting com wrote:(I would just use getClass().getClassLoader().getResourceAsStream() to not have to worry about relativity of paths)
You should better get it via <tt>getClass().getResource("somefile.xml")</tt> But in this case the file must be present in the classpath in the same package as the Class aquireing it. Adding a <tt>'/'</tt> in front of the file name expects it in the root directory of a classpath entry.
TPD Opitz-Consulting com wrote:Its an interesting comment. I shall now spend some time thinking of a way you would not know and not be able to find out.gimbal2 wrote:That's a good idea if you know the absolute path of the desired file.
(I would just use getClass().getClassLoader().getResourceAsStream() to not have to worry about relativity of paths)