Re: path in .java question
Re: path in .java question
- Subject: Re: path in .java question
- From: Theodore Petrosky <email@hidden>
- Date: Fri, 02 Sep 2011 20:15:10 -0700 (PDT)
I never thought about the write implications. I am only interested in reading the file.
to that end, I tried this and it 'works' for my needs. Of course I will probably just put the data into the database and eliminate the need to read a file directly.
ERXResourceManager resMgr = (ERXResourceManager) ERXApplication.application().resourceManager();
String mapFilePath = resMgr.pathURLForResourceNamed("AllCountries.txt", null, null).toString();
mapFilePath = mapFilePath.replace("file:/", "/");
System.out.println(" path is : " + mapFilePath);
File f = new File(mapFilePath);
I see that pathForResourceNamed is deprecated. it is recommended to use pathURLForResourceNamed. Do I understand that I must clean up the path string or is there a direct method that returns the path?
Thanks, Ted
--- On Fri, 9/2/11, Mike Schrag <email@hidden> wrote:
From: Mike Schrag <email@hidden>
Subject: Re: path in .java question
To: "Ted Archibald" <email@hidden>
Cc: "Theodore Petrosky" <email@hidden>, email@hidden
Date: Friday, September 2, 2011, 11:07 AM
In the general case, if it's a WebServerResource, you can't count on being able to write to it because it could live on a completely different machine that is serving your webserver static resources in a split install.
ms
On Sep 2, 2011, at 10:57 AM, Ted Archibald wrote:
You should use WOResourceManager/ERXResourceManager
On Fri, Sep 2, 2011 at 8:53 AM, Theodore Petrosky <email@hidden> wrote:
I want to read a file when my app launches:
File f = new File("AllCountries.txt");
I don't understand the path! if AllCountries.txt lives in the WebServerResources folder, what is the path I should use to access it?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden