Working with scanner which can't find my file

Hi, all:
I'm working with the Scanner class for the first time, and I'm trying to go through the tutorial. I'm using Eclipse. When I try to access the file called "xanadu.txt" when running the application ScanXan, I'm throwing a file not found exception. I have the file xanadu.txt in the same location as the class file, and for good measure I tried to explicitly specify where the file was when accessing it. Apparently one can't do that. What am I doing wrong?

Yes, the tutorial is assuming the text file is in the same directory as the class file. But how does your program know which directory that is? It looks up the current directory, which is stored in the system properties under the key "user.dir" when the JVM starts up. It's actually the directory from which java.exe was executed, but if the class you're running is in the default package (as yours is), the class file has to be in the same directory.
However, IDE's tend to create their own environments in order to facilitate debugging, profiling, etc. They pretty much ignore the PATH and CLASSPATH settings in your OS--in fact, they usually use their own compilers. As a result, you can't make any assumptions about the current directory.
I'm not saying the IDE definitely is causing the problem, just that it muddies the water. Also, it can be difficult for neophytes to keep Java knowledge separate from IDE knowledge. There's so much to learn in both areas, it's best to get a good grounding in Java before you start learning the IDE.
@Farmor, the {color:000080}try{color} block is only there so they can add the {color:000080}finally{color} block, which makes sure the stream gets closed; the exception is handled by the {color:000080}throws{color} clause in the method declaration.

Similar Messages

  • WLAN driver fails to install on G580 Windows 7 x64 with error "BCM4313: Can not find setup file"

    Summary:
    I have installed Windows 7 Ultimate x64 on my G580.  Everything is working fine except the WLAN driver fails to install with the error "BCM4313: Can not find setup file".
    Details:
    I bought lenovo G580 with Windows 8.  Since my parents are not comfortable with the learning curve of Win 8, I successfully downgraded to Windows 7 Ultimate x64.  Everything is working fine but my WLAN card is not recognized because of lack of driver.
    The lenovo parts look-up page says I have broadcom WLAN card - CBT BCM4313 MOW HMC WLAN
    I looked at lenovo driver downloads site and tried following driver files for Windows 7 and both of them failed to install with the following error.  I tried installing other WLAN drivers also but they won't even install as required hardward is not there.
    Error -  "BCM4313: Can not find setup file"
    Drivers Tried:
    - http://support.lenovo.com/en_US/downloads/detail.p​age?DocID=DS028105
    - http://support.lenovo.com/en_US/downloads/detail.p​age?DocID=DS028208
    Any help about how to get past this error will be appreciated.  The previous Widnows verison (Windows 8) is still on my hard-drive as windows.old folder.  Let me know if I can copy a specific file from there.
    Thank you.
    BJS
    Solved!
    Go to Solution.

    Download this driver bcm4313
    Start setup and extract the files.After that go to star menu/control panel/system/device manager.There you probably find out that network adapter driver is missing.Choose it and click with right mb for drop menu to show up.Select properties then Driver/Update Drivers...Select to load driver from computer hard drive and choose the path where extract files is.Default path is main partion C: and search for directory named Driver.
    And yes...you get "Can not find setup file" error but dont worry.Files needed to instal driver are extract fine.

  • Configuring IIS to work with Tomcat - I can't find a good help document

    Hello All,
    I am relatively new with Java and I am just now trying to learn Tomcat and servlet technologies. I can get the servlets working on my personal computer, yet I cannot get it configured for the server. From all the forum posts and web sites I have researched, it is my understanding that there is a configuration process that needs to be done to allow IIS to request the Tomcat servlet. However, maybe I'm just plain dumb, but I can't understand all the how-to's that I have found.
    I am assuming I DLed the appropiate .dll file and I placed it in Tomcat's bin folder.
    But then I have to create a properties file? I have no clue how to do this.
    I am still messing with the instructions, etc., but if anyone has any suggestions, or maybe a link to a dummie-fied How-to page, that would be extrememly helpful.
    I am currently running IIS on a win2k server.
    Thanks guys.
    (btw, for people who are having trouble setting the environment variable, with win2k, I was trying to do it with DOS, and it did not work. However, using the control panel > system > I was able to do it and the setting "stuck")

    No, you don't need Apache to make Tomcat work with ISS.
    There's a Wrox book entitled "Professional Apache Tomcat" that has a chapter on how to mate Tomcat with IIS. It gives step-by-step instructions that I've followed successfully a number of times.
    There are a few Tomcat books on the market now. I'd be surprised if they didn't address this. Go to Borders and pick one up. - MOD

  • Which epson wireless printer will work with airport extreme (can not find out from epson)

    three systems in use Win 7, Mac lion and vista.  Former epson printer WF 600 would not link with my new airport extreme router despite multiple attempts through epson.  Does anyone know of a wireless printer that will work?  Thanks.

    I had the same problem. It was fixed by running the silly app downloadable from their support page: http://support.lexmark.com/perl/support/support.cgi?ccs=229:1:0:0:0:0
    Here's another way, through CUPS:
    1) http://127.0.0.1:631/
    2) Administration tab
    3) Add Printer
    4) Give Name, Location, and Description (pretty inconsequential)
    5) Select device: Internet Printing Protocol (http)
    6) Device URL: lexnet3://192.168.5.110:1 (the parts in bold must be there, the ip add is probably different)
    7) Make: Lexmark
    8) Model: 3600-4600 series (if this isn't there, you need to get the driver from Lexmark)
    That should do it.
    The printer will be in your system preferences.
    The port number and the "lexnet3://" is the interesting part. Without them, I don't think you'll be able to get it working.
    Good luck
    Message was edited by: swbooth

  • How to export iPhoto Album in iMAC and have similar folder structure(with Timestamps) which can be viewed in finder

    How to export iPhoto Album in iMAC and have similar folder structure(with Timestamps) which can be viewed in finder
    In simple terms, I wanted to view the photos in Windows system, similar strcture of iPhotos

    If you want to copy all of your photos to a Windows machine and have them in folders representing the iPhoto Events the were in quickly and easily just do the following:
    1  - open the library with the Finder as shown in this screenshot:
    2 - COPY the Originals/Masters folder to the Desktop.
    3 - copy the Originals/Masters folder to the Windows machine.
    This will give you all of your original image file in their Event folder on the Windows machine.
    NOTE:  With iPhoto 8 or newer the Event folders in the Masters folder will be titled by date (EXIF) if imported from a camera.  If imported from a folder the event folder will have the same title as the source folder.  If imported singularly or in a group without a folder the title will be a date, either the EXIF date or import date.
    With iPhoto 7 (08) and earlier the Event folders in the Originals folder will have the same title as the Event has in the library.
    This method would be quicker but not provide the additional metadata you might have added in iPhoto like keywords, titles, descriptions that exporting out of iPhoto with Format=JPEG and the checkboxes selected to include keywords, titles, places, etc, checked.
    OT

  • How do I transfer files from a flash drive to iMac. I get a folder with "no name" which I can live with but I can't find any way to make the actual physical transfer of the files to the iMac.

    How do I transfer files from a flash drive to my new iMac?  I get a folder with "no name" that I can live with but I can't find a way to transfer the flass drive files to to iMac hard drive.

    What happens when you try to drag & drop the files?
    ~Lyssa

  • Time machine working well but I can't find backed up files fast enough?

    Time machine working well but I can't find backed up files fast enough. When I look in Time machine backups I'm looking in a folder and I can't remember what it was, but I go back in time and the finder goes from 98 files to 100 files, how do I find which 2 files were the ones deleted? Going back and forth from past to present is a pain! I need to figure out which file it was faster? Have any ideas?
    With the new "Find" feature it actually highlights what you are looking for such as in Safari. Does Time Machine have a feature to highlight the files/folders that were deleted really from the present?

    It sounds like you aren't looking for any file in particular, but notice a change in number of files and would like to know what changed rather than knowing that a specific file is now missing.
    that's a good point, and it appears that TM is not setup to describe the changes over time. If I recall correctly, it has a plug-in ability, so maybe somebody will fill in that void.
    Sheldon

  • HT1495 My husband and I share an i cloud account but each have our own separate ipads. We were told this would work, but now I can't find a book that I've downloaded on my ipad anymore. Where would I find it?

    My husband and I share an i cloud account but each have our own separate ipads. We were told this would work, but now I can't find a book that I've downloaded on my ipad anymore. Where would I find it?

    You and your husband can share a store account and still have seperate iCloud accounts for your contacts, bookmarks and stuff like that.  Click here for instructions to make an apple account without entering a credit card.  Make sure you use a different email address for each apple account. 
    Set up your iPhone/iPad whatever using the new account for iCloud.  Then go into settings/store and sign in with your purchasing account, you may need to sign out of the other account.  To the best of my knowledge, your household is allowed to share purchased legally, someone please correct me if I'm wrong.
    Once you each have your own devices set to your own accounts you can set them to backup to that account and it will keep all your contacts seperate.

  • I need to know how to delete the most recent version of Firefox. I JUST downloaded it tonight and my computer doesn't have that little edit bar to work with so I can download the proper Adobe player and my internet has been screwed up ever since I downlo

    I need to know how to delete the most recent version of Firefox. I JUST downloaded it tonight and my computer doesn't have that little edit bar to work with so I can download the proper Adobe player and my internet has been screwed up ever since I downloaded the new version of Firefox. I just want the old version of it back since I apparently can't download the Adobe stuff that is necessary to keep my computer safe from Hackers. It sure would have been nice to know there was an issue with the new Firefox Update BEFORE I uploaded it. I have Vista which is usually an issue with both Adobe and Firefox. I don't seem to be able to run much of Adobe at all on my computer because of the Vista.
    == This happened ==
    Every time Firefox opened

    I have also noticed all my settings won't stay set, example....I removed the check mark from "third party cookies", the when I close Firefox and reopen the check mark is back, also my tool bar has screwed up....can't reset, been having trouble the up grade.

  • I just put Facetime on my MacBook and Ipad. I can connect and recieve video but no sound. The other person can hear me. If I use Skype everything works fine. I can't find any where in Facetime to change settings for the audio. Any suggestions

    I just put Facetime on my MacBook and Ipad. I can connect and recieve video but no sound. The other person can hear me. If I use Skype everything works fine. I can't find any where in Facetime to change settings for the audio. Any suggestions

    Options for when an iOS device gets locked because of forgotten passcode:
    Restore (and reset passcode) on your device by connecting it to the last computer to which it was connected:
    iTunes: Backing up, updating, and restoring iOS software - http://support.apple.com/kb/HT1414
    If you cannot connect it to the computer to which the device was last connected (or the device was never connected to a computer) you will have to use recovery mode to completely reset the device, losing all data:
    iOS: Unable to update or restore - http://support.apple.com/kb/HT1808 - recovery mode (e.g., cannot connect to computer last used to sync device, iTunes still asks for a password)
    If recovery does not work there's:
    DFU mode: http://osxdaily.com/2010/12/04/ipad-dfu-mode/
    How to put iPod touch / iPhone into DFU mode - http://geekindisguise.wordpress.com/2009/07/16/how-to-put-ipod-touch-iphone-into -dfu-mode/

  • After Effects freezes when working with footage which is just being rendered

    After Effects freezes when working with footage which is just being rendered... this is a bug which was introduced with CS6 and I wonder if this is really so hard to fix. When you are working with footage from a 3d application which is just being rendered (in my case on a small farm via deadline) it has become impossible to work with After Effects. AE freezes for several minutes and only eventually returns to work. I suspect After Effects is reloading newly rendered frames in the background although I have disabled that in the preferences. With CS5 i can work on the frames already rendered without any problems. I filed a bug report about a year ago.
    Greetings,
    Daniel

    If you don't have Service Pack 1 for Windows, you should get it.  No guarantees, but it may help.  For the moment, I'd just wait until the 3D renders are complete before importing... there isn't much else you can do at the moment, anyway.
    There's only one application I've seen that can reliably, "works-every-time", read media files as they're recorded: Avid Newscutter...but then, it was created to do precisely that.  AE wasn't.

  • I tried Firefox 4.0, and it doesn't work with Yahoo. Until you find a fix, I have to stay with 3.6

    I tried Firefox 4.0, and it doesn't work with Yahoo. Until you find a fix, I have to stay with 3.6

    For older Macs that aren't supported in Firefox 4.0, try TenFourFox for PowerPC's running Mac 10.4.11 & 10.5.8 . <br />
    http://www.floodgap.com/software/tenfourfox/
    Or you can revert to 3.6.16. <br />
    http://www.mozilla.com/en-US/firefox/all-older.html

  • HT5625 I cannot send a text thru iMessage.  I followed the directions over and over again but can't make it work.  Also how can I find out all the apple ids I may have.

    I cannot send a text thru iMessage.  I followed the directions over and over again but can't make it work.  Also how can I find out all the apple ids I may have.

    A wet phone is out of warranty. This is considered user damage. Even if you were able to get it to start now, the chances of it working for long are slim. I suggest going to Apple and see about an OOW replacement. One for the iPhone 4 is only $149USD and it would come with a short warranty. It is a refurbished device and you would not be worried about encountering additional problems.

  • Final Cut Pro does not work with Yosemite. Can it be fixed?

    Final Cut Pro does not work with Yosemite. Can it be fixed?

    Hi Tom, I don't know if you can help me.
    I'm using Final Cut version 10.1.4 with Yosemite 10.10.2 and whenever I open FCP it opens for about 5 seconds (not allowing me to click anywhere) before closing with the message  "Final Cut Pro quit unexpectedly. click reopen to open the application again. This report will be sent to apple automatically." I have tried opening it multiple times and the same thing has been happening over and over again and i've tried everything I could find on the internet and nothing is working.
    HELP.
    Jada.

  • My Xlite 4.0 software does not work with Jetpack but does work with droid hotspot can this be fixed?

    My Xlite 4.0 software does not work with Jetpack but does work with droidx hotspot can this be fixed?  I have attached a packet capture for packets from DROIDX with android 2.3.4 marked as XliteWith3G.cap and a packet capture for Xlite with the Jet pack XliteWith4G.cap   obiviously same packets coming from Xlite different results depending on WiFi connection.

    Hi Vidya,
    Thanks for posting your example. You may want to remove your workspace details from the previous posting, or at least update the password on the workspace. I've taken a look at your example and initially couldn't see anything wrong with your tree query. However, when I ran your query in SQL Workshop, it only returned one row, which would explain why you were only seeing one node in your tree! I've updated your query to use a WITH clause, and the tree is now working correctly. I believe you've hit an underlying database bug where the CONNECT BY query is only returning 1 row, when in fact it should return > 1 row. By re-writing the query to use a WITH clause, you can get around the problem.
    Regards,
    Hilary

Maybe you are looking for