• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can't access a Resource file (was:reading a file form a component NoSuchFileException)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't access a Resource file (was:reading a file form a component NoSuchFileException)


  • Subject: Re: Can't access a Resource file (was:reading a file form a component NoSuchFileException)
  • From: Gustavo Pizano <email@hidden>
  • Date: Fri, 23 Oct 2009 12:55:51 +0200

Daniele:

Thanks  that made it!! I thought. NSBundle was cocoa-only.

G.


On Fri, Oct 23, 2009 at 9:58 AM, Daniele Corti <email@hidden> wrote:
Hi Gustavo,
    I know you can use NSBundle to manage file in resources:

        String path = NSBundle.mainBundle().pathURLForResourcePath("test.txt").getPath();
        NSLog.out.appendln(path);

   or you can simply read the file using:

       byte[] b = NSBundle.mainBundle().bytesForResourcePath("test.txt");
       NSLog.out.appendln(new String(b));

Hope this help

--
Daniele Corti
--
I DON'T DoubleClick


On Fri, Oct 23, 2009 at 09:12, Gustavo Pizano <email@hidden> wrote:
I renamed the subject.. its more appropiate .

///////

I used the
String res = WOApplication.application().
resourceManager().urlForResourceNamed("patterns.txt", null, null, null);
 FileInputStream fstream = new FileInputStream(res);
and still giving me FileNotFoundException.

:(

/////

Im sorry this is more Java related, i think,

Hello,  i need little help here, i alwasy crash myself in this, I put a .txt file in hte resources folder, now i need to read it from within a .java of a WOComponent.
I have tried many things, but its not working.

I have this structure: XWSLocalizer.woa>contents>Resources>patterns.txt

and the component its in XWSLocalizer.woa>contents>Resources>java>xws>localizer>components

I have tried: FileInputStream fstream = new FileInputStream("../../../../Resurces/patterns.txt");
FileInputStream fstream = new FileInputStream("../patterns.txt");
FileInputStream fstream = new FileInputStream(".patterns.txt");

just doing a try and error, but nothign seesm to work here.

i was wondering if I put somethign in the Resources folder is there  a way to go there with some Wonder or WO class, or somthing like that?


Cheers
G.



 _______________________________________________
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




 _______________________________________________
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

References: 
 >Can't access a Resource file (was:reading a file form a component NoSuchFileException) (From: Gustavo Pizano <email@hidden>)
 >Re: Can't access a Resource file (was:reading a file form a component NoSuchFileException) (From: Daniele Corti <email@hidden>)

  • Prev by Date: Re: Can't access a Resource file (was:reading a file form a component NoSuchFileException)
  • Next by Date: Re: War deploy; maven archetypes problems; web.xml filtering
  • Previous by thread: Re: Can't access a Resource file (was:reading a file form a component NoSuchFileException)
  • Next by thread: java.lang.IllegalStateException: CookieParser?
  • Index(es):
    • Date
    • Thread