|Re: direct resource path [message #757919 is a reply to message #755467]
||Wed, 16 November 2011 15:44
| Eric Rizzo
Registered: July 2009
In general, this is not an Eclipse-specific question and would probably |
get more response on a general Java or JEE forum such as stackoverflow.com
I can say that, in general, Java web apps are not supposed to read from
and write to the local file system. I think the JEE spec (and some
containers) even prevent it altogether. Imagine what would happen when
the webapp is deploed as a WAR file, as is often the case? You can't
read/write inside a WAR file.
Google and/or a more general Java/JEE forum can provide some
alternatives to achieving your goal.
On 11/8/11 10:29 AM, LordMax wrote:
> Hi to all.
> I'm a newby of eclipse and of java also so prease, be patience
> I have a problem figuring out how to set the path from one file to another.
> I have a very trivial structure:
> - project
> - package1
> - src
> - file1
> - file2
> - ...
> - static
> - static1
> - static2
> - ...
> - WebContent
> - WEB-INF
> - etc
> - users.txt
> in file1 I need to open users.txt
> in file2 I need to write some data into static2.
> I can't figure out the path from file1 to data.txt and from file2 to
> static2 and so on
> I've tried (for webcontent):
> addItem( user, "./project/WEB-INF/etc/users.txt");
> addItem( user, "/project/WEB-INF/etc/users.txt");
> addItem( user, "WebContent/WEB-INF/etc/users.txt");
> addItem( user, "./project/WebContent/WEB-INF/etc/users.txt");
> and so on but nothing works
> Can someone help me please?
Powered by FUDForum
. Page generated in 0.02968 seconds