users@glassfish.java.net

Re: Loading files from deployed .WAR

From: <glassfish_at_javadesktop.org>
Date: Mon, 26 Apr 2010 02:02:14 PDT

Do you ever had that moment when you have tried to find a solution for 1 problem 2 days, and you slowly going nuts, laughing by yourself in the dark corner?

Well I just had one of those moments.

2 days of searching, testing, headache, frustration and the solution was dumb.

I could run Junit tests from ant task, but they failed because they couldn't load a properties file from directory - not found. Though in eclipse all was fine.

After 2 days, this is what saved me:
                System.out.println(new File("myconf.properties").getAbsolutePath());
I say that the path doesn't start with /MyProject/build/...
But it was /MyProject/ant/build/...

So, the solution was, I just moved my ant build file to /MyProject directory
Now the thing works, because project paths apply now.

/MyProject/ant solution would have been define directories in my app
like ../build/
instead of just build/

Thanks for solving it! > No problem man.
[Message sent by forum member 'questioneverything']

http://forums.java.net/jive/thread.jspa?messageID=399019