Skip to main content

relative path to web app files

6 replies [Last post]
mdebac
Offline
Joined: 2007-07-10

Hi,
I have problem to locate files with relative url in my web app wich is running on glassfish;
when I put it under web-inf/someDir/file.txt I canot get it. It seems that relative
path is at glassfish\domains\domain1 and not from within web applications isolated?

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
domdorn
Offline
Joined: 2009-06-20

you cannot access files below WEB-INF/

On Sun, Nov 7, 2010 at 2:55 PM, wrote:
> Hi,
>
> I have problem to locate files with relative url in my web app wich is
> running on glassfish;
>
> when I put it under web-inf/someDir/file.txt  I canot get it. It seems that
> relative
>
> path is at glassfish\domains\domain1 and not from within web applications
> isolated?
>
>
>
> Thanks.
>
>
>
>
>
>

334 Guest
Offline
Joined: 2010-11-08

 

ok, but I have also put files under package, under src/java..,  and problem
persist.

When I try to run the part of aplication wich use the file with in the main
funcion in the class, I can get the file with relative path
src/java/package/com,

but when I deploy it under glasfish to run it like web aplication, it can not
see it any more.

 

As I mentioned, I have try to create new File(test.txt), and it put it under
glasfish/domain/domain1  directory

 

mdebac
Offline
Joined: 2007-07-10

ok, but I have also put files under package, under src/java.., and problem persist.
When I try to run the part of aplication wich use the file with in the main funcion in the class, I can get the file with relative path src/java/package/com,
but when I deploy it under glasfish to run it like web aplication, it can not see it any more.

As I mentioned, I have try to create new File(test.txt), and it put it under glasfish/domain/domain1 directory

domdorn
Offline
Joined: 2009-06-20

It looks like you have some misunderstandings of how java web applications work.

I highly suggest working through the JavaEE 6 Tutorial
http://download.oracle.com/javaee/6/tutorial/doc/

At least do Part I and Part II.

On Mon, Nov 8, 2010 at 10:11 AM, wrote:
>
>
> ok, but I have also put files under package, under src/java..,  and problem
> persist.
>
> When I try to run the part of aplication wich use the file with in the main
> funcion in the class, I can get the file with relative path
> src/java/package/com,
>
> but when I deploy it under glasfish to run it like web aplication, it can
> not
> see it any more.
>
>
>
> As I mentioned, I have try to create new File(test.txt), and it put it under
> glasfish/domain/domain1  directory
>
>
>
>

mdebac
Offline
Joined: 2007-07-10

Thanks, I wil find part what I need,
but do you think that is there a question whose answer isnt alredy written in some documentation with a link?

ray_martin
Offline
Joined: 2006-08-17

The documents to which you were pointed are essential.

But, here is an additional thought:
Get the latest copy of Netbeans.
Use Netbeans to create and deploy a web app (use a default or sample).
By observing what Netbeans did, one knows how to perform correctly.
Then using the documents to which you were pointed, one learns how to expand.