• 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
Can't Use java.io.FileInputStream Within Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't Use java.io.FileInputStream Within Cocoa


  • Subject: Can't Use java.io.FileInputStream Within Cocoa
  • From: Orbital Media Design <email@hidden>
  • Date: Fri, 13 Jul 2001 19:14:35 -0600

Hello,

I have found a very peculiar bug when using the java.io.FileInputStream within a java cocoa app. I'm trying to read a text file line by line, so I have to use the java.io classes here (correct me if there is a Java compatible Cocoa API that I can use instead). This is the gist of the code for opening the file stream, pretty standard.

File inputFile = new File("input.txt");
FileInputStream in = new FileInputStream(inputFile);

The text file input.txt is within the same folder as the application itself, so the path for inputFile is correct. However, when I build the project from PB, and run it by double-clicking its icon and start the file reading method, I get a "FileNotFoundException" saying it can't find "input.txt." I then remake the project so it is a pure java app, and the FileInputStream happily locates the file. To confuse matters even more I run original cocoa java project from within Project Builder, and again FileInputStream properly locates the input.txt file. Thinking that this is just a problem with my installation of OS X (10.0.4), I tried it on another computer and got the same results. I simply cannot get FileInputStream to work within a cocoa app when I start it by double-clicking the icon.

Has anyone else had a similar experience using the java.io classes within a java cocoa app? Any work-arounds? I am a student programmer, so I really have no idea where to go from here. Thanks in advance,

-Jonathan Sick


  • Follow-Ups:
    • Re: Can't Use java.io.FileInputStream Within Cocoa
      • From: Andre John Mas <email@hidden>
    • Re: Can't Use java.io.FileInputStream Within Cocoa
      • From: John Timmer <email@hidden>
    • Re: Can't Use java.io.FileInputStream Within Cocoa
      • From: François Frisch <email@hidden>
  • Prev by Date: ***MACWORLD STUDENT BOF/LUNCHEON ANNOUNCEMENT!!!***
  • Next by Date: Re: Can't Use java.io.FileInputStream Within Cocoa
  • Previous by thread: Re: retainCount
  • Next by thread: Re: Can't Use java.io.FileInputStream Within Cocoa
  • Index(es):
    • Date
    • Thread