users@glassfish.java.net

Re: Read file from docroot

From: Byron Nevins <Byron.Nevins_at_Sun.COM>
Date: Tue, 27 Nov 2007 10:23:02 -0800

Glad to help!

yonestar wrote:
> Byron,
>
> this was exactly what i needed!!
> thanks for the "ghastly hack" :-)
>
> Y
>
>
> Byron Nevins wrote:
>
>> This is a ghastly hack but I use it to solve this exact problem.
>>
>> GlassFish's current directory is *guaranteed* to be <domain-dir>/config
>>
>> To get to the (default) docroot, I do this:
>>
>> File docroot = new File("../docroot")
>>
>> // optional but recommended
>> try { docroot = docroot.getCanonicalFile(); }
>> catch(IOException e) { docroot = docroot.getAbsoluteFile(); }
>>
>> It's not a great solution but it's better than hardcoding an absolute
>> path.
>>
>>
>>
>
>