I have an Enterprise application comprising 1 web comp & several EJB’s.
From the Web component I want to read the contents of a file that will be supplied with the packaged EAR file.
The deployment directory structure looks like this –
I:\domains\dev\applications\MyApp\EJB1
I:\domains\dev\applications\MyApp\EJB2
I:\domains\dev\applications\MyApp\MyWeb
So I thought if I put the text file in this dir –
I:\domains\dev\applications\MYApp\MyWeb\WEB-INF\classes
then used used FileInputStream(fileName) it would find it – wrong!
Putting this bit of code in to see which directory it’s looking at –
File dir1 = new File (“.”);
try
{
System.out.println (“Current dir : ” + dir1.getCanonicalPath());
}
catch(Exception e)
{
e.printStackTrace();
}
produced I:\domains\dev – what the heck? – this is miles outside the app dir!
Any ideas? – must be something stupid I’m not doing!
thanks
harry