path in .java question
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 (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: path in .java question
You should use WOResourceManager/ERXResourceManager On Fri, Sep 2, 2011 at 8:53 AM, Theodore Petrosky tedp...@yahoo.com 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 (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/ted.archibald%40gmail.com This email sent to ted.archib...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: path in .java question
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 tedp...@yahoo.com 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 (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/ted.archibald%40gmail.com This email sent to ted.archib...@gmail.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com This email sent to msch...@pobox.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: path in .java question
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 msch...@pobox.com wrote: From: Mike Schrag msch...@pobox.com Subject: Re: path in .java question To: Ted Archibald ted.archib...@gmail.com Cc: Theodore Petrosky tedp...@yahoo.com, webobjects-dev@lists.apple.com 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 tedp...@yahoo.com 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 (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com