Can't get java to read my file input

I have a program that ask at prompt what the name of your input file will be... something for example like input.txt can be typed and a scanner puts that text "input.txt" into a string called maybe inputs.
The problem I am having is I can not get the scanner to then look at the string and open the file with the same name in the folder and read it.
I not sure if im putting the name correct in the new File so to make it look at "input.txt" and I keep getting Class FileNotFoundException
any ideas?
my code is below
File f = new File(inputs);
Scanner scan = new Scanner( f );
String name = "";
while(scan.hasNextLine()) // as long as there is another line to be read
     String text = scan.nextLine(); // read the first line
     Scanner scan2 = new Scanner(text); // set up a second scanner to process the String we just read in
     if(scan2.hasNext())
          name = scan2.next();
     else
          continue; // go to the next line
     System.out.println(name);
}

Java is likely looking for your file in a location other than where the file is. Do you know where your current user.dir is? Create a small program that does nothing but this:
class Fubar
  public static void main(String[] args)
    System.out.println(System.getProperty("user.dir"));
}Edited by: Encephalopathic on Mar 23, 2009 7:10 PM

Similar Messages

  • I can't get flash to read my file

    I have an audio file that I want to import into adobe flash (mp3) and I've converted it into every file type and codec imaginable and it still says there's a problem.

    what's the file type?
    if it's mp3, open in audition and save it with a bitrate of 44.1kb/s and test.  if that works, you can use (some) other bitrates better suited to your situation.

  • Than how can i get java class by using it's class file?

    Hi
    After compilation of a java program, it creates a class file.
    After getting class file suppose class file has been deleted.
    Than how can i get java class by using it's class file?
    Thanks in advance.

    get a decompiler and run your class file through it--I'll assume you want the source code back and that you are not trying to recover a missing class file by attempting to use the class file that is missing--if it's missing, then I've not a clue on how to get it back by using what is already missing.
    BTW: many of your compilers have source control--if it does, just restore your missing file.

  • I have iphoto '08 version with an imac osx 10.5.8. It will not read my RAW files  from my Nikon D800 - a very new model.How can I get it to read my RAW files?

    my somewhat old imac osx 10.5.8 with iphoto '08 will not read my RAW files from my new Nikon D800 camera - a new model on the market( 5 months or so). How can I get iphoto to read my RAW  files?

    iPhoto 08 would not read RAW files from that new a camera. You need to upgrade so you can get more up-to-date version of OS X and iPhoto. Another possiblity is see if iPhoto 11 will run on 10.5.8, if so you should update. You can also attempt to run Software Update and see if it finds a newer release of iPhoto 08 that supports newer RAW formats.

  • I have CS6 10.0.6 x64 extended on  Mac 10.6.8 and Canon 5D mark 111. I can not get CS6 to read my raw files. No new updates available. Any ideas guys?

    I have CS6 10.0.6 x64 extended on  Mac 10.6.8 and Canon 5D mark 111. I can not get CS6 to read my raw files. No new updates available. Any ideas guys?

    If you go to Photoshop>About Plug-in and click on the words Camera Raw, what version does it list?
    I suspect you still have Camera Raw 7.0
    When you go to Help>Updates from within photoshop cs6, it says nothing available?

  • Can we get the name of fmx file at runtime

    Hi all,
    can we get the name of fmx file which is doing some DML operation on a specific table Can we back track which fmx module has done DML on a specific table. The reason I need this because I've 7 different fmx files which are doing some DML operation on a specific table and these fmx files were used by different users. Not necessarily 1:1 For eg. one user can do DML through 3 different fmx files. So in such case if I want to want to know from which fmx file this DML has take place .How can I achieve that. I know I can get the oracle username through v$session but it will not suffice my needs. I need the name of fmx file also.
    I'm using:
    Forms [32 Bit] Version 10.1.2.0.2 (Production)
    Oracle Database 10g Release 10.2.0.1.0 - Production
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Any help?
    Warm Regards
    Percy

    Percy,
    For that you can set the Module Field in the V$session in each form by,
    DBMS_APPLICATION_INFO.SET_MODULE(MODULE_NAME => :SYSTEM.CURRENT_FORM, ACTION_NAME => USER);Write this in each form, and then you will get the form name in the V$SESSION's module field with form name.
    Hope this helps.
    Regards,
    Manu.

  • HT1338 Help I can't get Java to down load to my Mac version 3.06 I have did the soft ware up date ?

    Help I can't get Java to down load !

    Hello BROitsJAMIE,
    Thanks for using Apple Support Communities.
    I'd like you to please follow the troubleshooting in the article linked to below in order to resolve this issue with your Mail.
    OS X Mail: Troubleshooting sending and receiving email messages
    Take care,
    Alex H.

  • How can I get rid of a music file use in a menu?

    How can I get rid of a music file use in a menu? I try to get rid of it from the menu inspector but although I delete it there, it is still in use by the menu!
    it is not inthe audio window in the menu inspector but is still in use! wiered!

    Click on the menu with the audio, then look in the property inspector, under the 'general' tab.
    Towards the bottom there is the list containing the audio file for the menu - click on the file and use the '-' button in the bottom left corner of the PI...

  • How can I get Java to fill out form on web page and submit?

    I need to write a Java program that will submit a HTML form. I tried using POST already, but the only response I got back was the source code for the page itself. Looking more closely, I realized that there is a PHP script that will actually take the data from the forms and use it. How can I get Java to enter the data on the forms automatically and then run this PHP script? I don't need code, just a pointer in the right direction should do.
    Thanks in advance,
    Hasitha D

    hasithad314 wrote:
    I need to write a Java program that will submit a HTML form. I tried using POST already, but the only response I got back was the source code for the page itself. Looking more closely, I realized that there is a PHP script that will actually take the data from the forms and use it. How can I get Java to enter the data on the forms automatically and then run this PHP script? I don't need code, just a pointer in the right direction should do.
    If you are writing a program to submit a form,how come the PHP script come out of nowhere ? At this momemnt you are just writing some Java program,isn;t it ?
    My feeling is you are trying to edit some pre-written code.
    Is it ?
    Thanks.

  • Finder got an error: Can't get item 1 of {document file "foo" ...}

    I have a lot of files in Corel Painter 8's RIFF format. I want to write a script that opens a file and somehow forces Corel Painter 8 to save the file as a GIF. GUI scripting may be some help with the latter; now I am concentrating on finding RIFF files and opening them in Corel Painter 8.
    I have a script that does a depth-first search of the folders starting at some root folder, using the Finder application to do the file-system stuff. It creates a list with
    set docs to every document file of pages_folder whose file type = "RIFF"
    as it loops through folders it adds to the list like this:
    set more_documents to every document file of a_folder whose file type = "RIFF"
    set docs to docs & more_documents
    My naîve mental model is that docs is a list of document-file objects. Next I have a loop that attempts to strip out files for which a GIF file already exists (and is no older than the RIFF document). This works by deleting non-matching items like so:
    if not isgifneeded then
    set docs to items 1 thru (i - 1) of docs & items (i + 1) thru (length of docs) of docs
    end if
    Finally it tries to open one of the files in Corel Painter 8 using the Finder:
    open item 1 of docs using "Corel Painter 8"
    This does not work. I get an error message
    Finder got an error: Can't get item 1 of {document file "bar" of folder "foo" of folder "blah" of folder "pdc" of folder "Users" of startup disk, ... }."
    It lists all of the files. (The error message appears in a sheet that extends off the bottom of the screen!) They are identified in the message as document-file objects. The curly braces are, I believe, the AppleScript notation for a list. I expect to be able to obtain the first element of a list with ‘item 1 of xs’. My assumption is that the Finder’s open command would expect a document file object, or at least would be able to cope with being asked to open a document. What am I missing here?
    PowerBook 12" without mini-DVI   Mac OS X (10.4.7)  

    Hi Damian and welcome to Apple Discussions!
    One suggestion: try
    tell application "Finder" to open item 1 of docs
    (without 'using "Corel Painter 8"')
    As far as the Finder is concerned, "Corel Painter 8" is just a string of characters. And telling the Finder to open a file is just the same as double-clicking it: the Finder knows which app to use - as long as these are native Corel Painter 8 docs.
    Hope this helps,
    H

  • I can't get java to work on my Mac. It is installed and enabled. I can't activate java per site because I don't get "click here to activate" box.

    I can't get java to work with Firefox on my mac with OS 10.6.8. I did everything suggested and still no luck. Java is installed, enabled, and updated. I can't even activate java per site because I don't get the "click here to activate" box for some reason. Apple support said it's a firefox problem and they can't help me. I need to be able to use java!

    hello, please update firefox to the latest version & your OS to 10.6.8.
    [[Update Firefox to the latest version]]
    http://support.apple.com/kb/HT4561

  • How can i get out the reading list???

    how can i get out the reading list?

    This really needs to be posted in the Safari forum but I will answer it here.
    What do you mean by get out? You want to see the list? Clicking on the pair of glasses controls the display of the list. The glasses are in the gray bookmark bar. Click once to open and click again to close the reading list.

  • Had to restore, now I can't get iTunes to read the iPod

    I had to restore my iPod touch to factory setting when it froze up. Now I can't get iTunes to read the iPod. I get a sceen on iTunes that says "An iPod has been previously synced with this computer." Then there are two choices, "Set Up as a New iPod" or "Restore from the backup of: My iPod". I clicked on both and neither did anything. I can get music, but not apps, to go on the iPod, but I usually add things to the iPod manually. I don't see a way to do this. I have also tried uninstalling and reinstalling iTunes. I have no idea what else to do. Some help, please!

    Go to Settings > General > Reset > Reset Network Settings
    After that go to Settings > Wi-Fi and key in your Wi-Fi settings.

  • How can I get Java plugin to work

    How can I get Java plugin to work ?

    Greetings Dun1203,
    Welcome to the Apple Support Communities!
    I understand that you would like to install or update Java on your Mac. For information on this process, please use the information provided in the attached link. 
    Java updates available for OS X on August 28, 2013 - Apple Support
    Cheers,
    Joe

  • How can I get VoiceOver to read two languages correctly?

    How can I get VoiceOver to read two languages correctly? in a dual-language book (English and Spanish)? I've used the <lang> tag, but VoiceOver doesn't switch from reading in English to Spanish. Both languages are selected in Settings. Does VoiceOver have this capability?

    How can I get VoiceOver to read two languages correctly? in a dual-language book (English and Spanish)? I've used the <lang> tag, but VoiceOver doesn't switch from reading in English to Spanish. Both languages are selected in Settings. Does VoiceOver have this capability?

Maybe you are looking for

  • Accessories for zen ext

    I've got a 40gb zen extra which I think is great but why are there so few accessories for it's:smileysurprised: The case it comes with is not very user friendly (can't see the screen!) and makes it really bulky. I would also really love a remote cont

  • Multi mapping and correlation

    Hi there i have an File -->  PI --> Idocs  Scenario, the File structure is something like this: 1  xxx yyy 9865 1  zzz www 9834 2  sss ttt 12392 2  rrr eee 45323 Basically they're deliveries with some additional info, I want to group them like this:

  • AirDrop from iPad mini to iPhone 5 not working.

    I'm trying to drop a picture from my new iPad mini to my iPhone 5. Both have iOS 7.0.2, both are set to airdrop:everyone, both connected to wifi. My phone shows up on my iPad, but once I try to make the transfer, i get the request on my phone but the

  • WIFI univercity TUHH (Eduroam)

    Hi people, I am now using Lumia 1520 and i get a problem with connection to my uni WLAN(eduroam) TUHH After search i see this network, then I'm trying to login with my username and pass and its says that connection is not possible I will leave a link

  • Mod date not displaying in Files panel Dreamweaver CC

    After upgrading to Dreamweaver CC, on OS X Mtn Lion, my Files pane will not display the Modification Date for both local and remote files. The column is there, but it's blank. I have tried hiding and showing that column in the Sites setup, but that d