> -----Original Message----- > From: Omair-Inam Abdul-Matin [mailto:[EMAIL PROTECTED] > Sent: Saturday, July 10, 2004 5:39 AM > To: [EMAIL PROTECTED] > Subject: Reactor: tests failing (working dir set to master > proj dir not > child proj dir) > > > I'm using JUnit to run some regression tests that need to read in > configuration and data files. For this it is necessary that > the working > directory be the same as the project directory. Recently the project > was subdivided into a master project and child subprojects. > Now when I > try to run unit tests by invoking the master build target, the tests > fail because apparently the working directory is the directory of the > master project not the current child project. I believe this > topic has > been brought up in a previous post but I was not able to find the > solution to the problem. > > Can someone please nudge me in the correction direction? > > Omair > >
You may also conider using classloader for loading your configuration files: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html#findResou rce(java.lang.String) Once you have an URL of required resource you can easly convert it to a File object and then use methods like file.getParentFile() for traversing directories Using this technique you can more easly test your code in your IDE. Michal --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
