Scanner Help Please ??

Hi All,
I am trying to read a line of text from a file. Actually in my assignment we have to throw exception from a file means we have to write the exception text in a text file and through accordingly. Please help as I am so tired from last night trying this and that it just doesnt work.
My file text is like this.
# This file stores the error messages for displaying into Change Calculator
1=Error reading transaction from the file.
I made a function which basically tells me how many lines I have to skip as comments.
After that I am just stuck I dont know how to read the line *1=Error reading transaction from the file.* I have tried Scanner class but it really working weirdly for me. This is my code:
if(exceptionFile.exists()){
readFile = new Scanner(exceptionFile);
numberOfComments = ReadFile.number_Of_Comments(exceptionFile);
//Skipping the comments
for(int i=0;i<numberOfComments;i++)
readFile.nextLine();
readFile.useDelimiter("=");
if(readFile.hasNext())
exceptionNumberFromFile = readFile.next();
exceptionText = readFile.next();
if(exceptionFile.exists()){
readFile = new Scanner(exceptionFile);
numberOfComments = ReadFile.number_Of_Comments(exceptionFile);
for(int i=0;i<numberOfComments;i++)
readFile.nextLine();
readFile.useDelimiter("=");
if(readFile.hasNext())
exceptionNumberFromFile = readFile.next();
exceptionText = readFile.next();
// The following line prints the first number and second line with = in it and also append second number like this
//1 - Error reading transaction from the file.
//2
System.out.println(exceptionNumberFromFile +" - "+ exceptionText);
// The exceptionNumber is passed as argument to this method and
if(exceptionNumberFromFile .equals("exceptionNumber "))
break;
//Throw the new exception
if(exceptionNumberFromFile!=null && exceptionText!=null)
throw new Exception(exceptionText);
else
throw new FileNotFoundException("Specified File Doesnt Exist.");
if(exceptionNumberFromFile!=null && exceptionText!=null)
throw new Exception(exceptionText);
else
throw new FileNotFoundException("Specified File Doesnt Exist.");
Please help !! ... and Thanx in advance ...

Hi,
Now I want Scanner to read a line of text from the file with format.
1=Error reading transaction from the file.
2=This denomination is not supported. There is inconsistency between denomination file and Initial count file.I want scanner to break one line with delimeter as '='. I want to get 1 in a String variable so that inside while loop I can check that Scanner has already read my error line and just throw it.
while(readFile.hasNext())
              // I want to store 1 here
               exceptionNumberFromFile = readFile.next();
              // I want to store Exception text here
               exceptionText = readFile.next(); 
                              //For testing
                              System.out.println(exceptionNumberFromFile +" - "+ exceptionText + exceptionNumber);
               //Break from loop if Exception number found in the file
               if(exceptionNumberFromFile.equals(exceptionNumber))
                   break;
            if(exceptionNumberFromFile!=null && exceptionText!=null)
                throw new Exception(exceptionText);
        }  Now weird means it gives me output as
1 - =Error reading transaction from the fileIt reads the delimeter as well.
Thanx in advance .. you geniuos people out there..

Similar Messages

  • Can't install win7 scanner driver for canon pixma mp260, help please !!!

    can't install win7 scanner driver for canon pixma mp260, help please !!!

    HOW CAN I FIX MY PIXMA CANON WITH OUT THE CD

  • Hi.Since I upgraded to Maverick my scanner which is Fuji Xerox Docuprint CM205 fw could not be used for scanning as mac wouldn't find the scanner.Can anyone help please?

    Hi.Since I upgraded to Maverick my scanner which is Fuji Xerox Docuprint CM205 fw could not be used for scanning as mac wouldn't find the scanner.Can anyone help please?

    There's an alternative ...
    Using Image Capture as a scanner:
    Connect the scanner to your Mac whether Wi-Fi or USB.
    Launch Image Capture.
    Click the very small black box bottom right side of the Image Capture window.
    You'll see this pop up menu:   Connecting this (device) opens:
    You can select a default app to scan (Image Capture) and select a folder from the Imort To pop up menu on the right to save scanned files to.

  • My macbook pro won't recognise HP C4480 scanner. Help please.

    My new macbook pro won't accept my scanner. I have a C4480 photosmart printer and it will print from my macbook but when i try to scan, it says unknown error. I have installed from HP CD and from HP website but makes no difference. Help please. Thank you.

    I also have this problem. My MacBook alays has trouble recognizing HP printers and scanners and I allways have to restart programs and reboot the laptop in order to scan with HP scanners.
    However with the C4480 it just does not work it doesn't seem to matter how many times I reboot.
    HP Products suck on the Mac. And tech support doesn't seem to have any answers.

  • I am having difficulty getting my scanner (HP5590 Scanjet) working with my MacBook Pro, can anyone help please. It did work alright with my IBM notebook.

    I am having difficulty getting my scanner (HP5590 Scanjet) working with my MacBook Pro, can anyone help please. It did work alright with my IBM notebook.

    There's a new driver bundle for OSX 10.6 that you might need to install, the HP link seems to be failing at the moment but there's a version of it here: HP_Installer_Scanjet_v2.4.3_Ph4.dmg
    There's a piece on the HP Forum about it here (some folks have problems installing ...)
    http://h30499.www3.hp.com/t5/Macintosh-Compatible-Products/Scanner-Drivers-softw are-for-Snow-Leopard-Mac-OSX-10-6-will-not/td-p/2301674

  • I am trying to download a plug in called adobe flash player 10.1.102 and error shows up that says instalation encountered errors sign in under administraive privileges and try again and i dont understand what that is or what to do. help please!

    im tryin to down load this plugin like it keeps suggesting because none of the video clips or games of any sort is showing and it wont download. it keeps saying theres an error and i need to sign in under administrative privileges but it doesnt give me that option. i dont understand what to do> help please!!!

    Follow the instructions below. Note the part about "Windows 7 and Vista".
    #'''Check your plugin versions''': http://www.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    #'''Update the [[Managing the Flash plugin|Flash]] plugin''' to the latest version.
    #*Download and SAVE to your Desktop so you can find the installer later
    #*If you do not have the current version, click on the "Player Download Center" link on the "Download..." page below
    #*After download is complete, exit Firefox
    #*Click on the installer you just downloaded and install
    #**Windows 7 and Vista: may need to right-click the installer and choose "Run as Administrator"
    #*Start Firefox and check your version again or test the installation by going back to the download link below
    #*Download and information: http://www.adobe.com/software/flash/about/
    #**Use Firefox to go to the above site to update the Firefox plugin (will also install plugin for most other browsers; except IE)
    #**Use IE to go to the above site to update the IE ActiveX
    <br />
    The information submitted with your question indicates that you have out of date plugins with known security and stability issues that should be updated. To see the plugins submitted with your question, click "More system details..." to the right of your original question post.
    *Adobe Shockwave for Director Netscape plug-in, version 11.0
    *Adobe PDF Plug-In For Firefox and Netscape
    **New Adobe Reader X (version 10) with Protected Mode just released 2010-11-19
    **See: http://www.securityweek.com/adobe-releases-acrobat-reader-x-protected-mode
    #'''Check your plugin versions''': http://www.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    #'''Update Shockwave for Director'''
    #*NOTE: this is not the same as Shockwave Flash; this installs the Shockwave Player.
    #*Use Firefox to download and SAVE the installer to your hard drive from the link in the article below (Desktop is a good place so you can find it).
    #*When the download is complete, exit Firefox (File > Exit)
    #*locate and double-click in the installer you just downloaded, let the install complete.
    #*Restart Firefox and check your plugins again.
    #*'''<u>Download link and more information</u>''': http://support.mozilla.com/en-US/kb/Using+the+Shockwave+plugin+with+Firefox
    #'''Update Adobe Reader (PDF plugin):'''
    #*From within your existing Adobe Reader ('''<u>if you have it already installed</u>'''):
    #**Open the Adobe Reader program from your Programs list
    #**Click Help > Check for Updates
    #**Follow the prompts for updating
    #**If this method works for you, skip the "Download complete installer" section below and proceed to "After the installation" below
    #*Download complete installer ('''if you do <u>NOT</u> have Adobe Reader installed'''):
    #**Use the links below to avoid getting the troublesome "getplus" Adobe Download Manager and other "extras" you may not want
    #**Use Firefox to download and SAVE the installer to your hard drive from the appropriate link below
    #**Click "Save to File"; save to your Desktop (so you can find it)
    #**After download completes, close Firefox
    #**Click the installer you just downloaded and allow the install to continue
    #***Note: Vista and Win7 users may need to right-click the installer and choose "Run as Administrator"
    #**'''<u>Download link</u>''': ftp://ftp.adobe.com/pub/adobe/reader/
    #***Choose your OS
    #***Choose the latest #.x version (example 9.x, for version 9)
    #***Choose the highest number version listed
    #****NOTE: 10.x is the new Adobe Reader X (Windows and Mac only as of this posting)
    #***Choose your language
    #***Download the file
    #***Windows: choose the .exe file; Mac: choose the .dmg file
    #*Using either of the links below will force you to install the "getPlus" Adobe Download Manager. Also be sure to uncheck the McAfee Scanner if you do not want the link forcibly installed on your desktop
    #**''<u>Also see Download link</u>''': http://get.adobe.com/reader/otherversions/
    #**Also see: https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox (do not use the link on this page for downloading; you may get the troublesome "getplus" Adobe Download Manager (Adobe DLM) and other "extras")
    #*After the installation, start Firefox and check your version again.

  • Scanning directly to PDF on Windows 7 - HELP PLEASE !

    I recently purchased an HP Probook 4540s that runs Windows 7 Professional and then learned that my HP Laser Jet 3052 all-in-one, that had beautifully scanned documents directly to PDF files when hooked-up to my old laptop that ran Windows XP Professional, doesn't scan directly to PDF.  I'm told (but don't know for myself) that's because HP doesn't have a scanning driver for Windows 7 and Microsoft's drivers don't scan to PDF  What can I do to have my 3052 scan PDF directly to my 4540s?  I'm I stuck with having to buy a new scanner and, if so, which one(s) will scan directly to PDF on Windows 7 with an automatic feeder?  Of course I can scan to TIFF and then convert to PDF, but what a hassle and the product is so much less sharp.  Help, please!

    As I'm sure you are aware you've asked in an Adobe hosted forum for Acrobat not a generic Q&A area like Yahoo Answers.
    With that in mind --
    Purchase and install Acrobat XI (Standard or Pro).
    Visit the HP site to obtain/install  the latest greatest drivers for the scanner.
    If there's an appropriate TWAIN driver Acrobat will be able to "talk" to the scanner to facilitate creationg of PDF from the scanner's output image(s).
    If not then use the scanner's software to output scanned images of textual content to TIFF.
    Then use Acrobat to create PDF from the TIFF files.
    Alternatively you may want to give a look-see to Adobe's online subscription services.
    https://www.acrobat.com/welcome/en/home.html
    Be well...

  • I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!

    There are no updates to either OS 10.5.8 or Safari 5.0.6.
    If you need a later version of Safari you must first upgrade your operating system to a later version of OS X.

  • At the end of my IMovie I want to write some text: as in" Happy Birthday Mandy we had a great time with you. etc..  How do I go about this? Which icon in IMovie lets me have a place to write text?? help please

    Please see my ? above: Im making an IMovie and need the last frame to just be text (can be on a color). I don't know how to go about doing this.  Ive already done all my photos and captions. Need to have it ready for TOMORROW: Friday May 23rd. Help please!
    Thanks

    You can choose a background for the text from Maps and Backgrounds.  Just drag a background to the end of the timeline, adjust to desired duration then drag title above it.
    Geoff.

  • I have just updated my PC with version11.14. I can no longer connect to my Bose 30 soundtouch via media player Can anyone help please

    I have a Bose soundtouch system .Until today I could play my iTunes music through it via air  player . .I have just uploaded the latest upgrade from iTunes and now I am unable to connect to the Bose system . Can anyone help please? I can connect via my iPad and by using the Bose app so it is not the Bose at fault

    @puebloryan, I realize this thread is a bit old, but I have encountered a similr problem and wondered if you had found a solution. I've been using home sharing from itines on my PCs for years, but two days ago, it suddenly stopped. I can share from my Macs, but not from the ONE PC library where I keep all my tunes. I tried all the usual trouble-shooting measures.
    After turning home sharing off on the PC's iTunes, turning it back on and turning some other settings off and on, my Macs and Apple TV could briefly "see" the PC library, but as soon as I try to connect -- the wheel spins for a bit and then the connection vanishes. It's as if they try and then give up.
    Since this sounds so similar to your problem, I was hoping you finally found a solution. I am also starting a new thread. Thanks!

  • My iMac 24 can no longer be paired with the keyboard; it doesn't recognise any keyboard at boot up, even the one it is paired with. Can anyone help, please?

    My iMac 24 can no longer be paired with the keyboard; it doesn't recognise any keyboard at boot up, even the one it is paired with. Can anyone help, please?
    Thank. Simon

    Brian - The batteries are fine and there has only every been one keyboard paired with it. We have tried my MacPro keyboard as well, and it will not even recognise that there is a discoverable keyboard nearby.
    Thanks, Simon

  • Photoshop Elements 6 on Mac help please !!!!!

    Hi there,
              I need help please !!!!!
    I have PSE 6 for my imac and bought myself a NIKON D60 so far so good. I have installed PSE 6 which comes with ADOBE Bridge CS3
    I have bought a book as well as I am new to photoshop and in fact DSLR cameras.
    I have got my photos into Bridge OK by the way they are JPEG format. According to the book I can open the JPEG in camera RAW by either selecting the JPEG and then pressing cmd+R or by selecting the JPEG and select open with and camera RAW should be available to selct.
    I cannot get of the options to work any ideas please
    Secondly I have taken some photos in RAW format and put then into Bridge again I cannot get the camera RAW interface to open with these neff images.
    If I try to open the image PSE 6 opens and gives me an error that the file format is not supported by PSE 6
    Am I missing something here as I have been trying for a week now !!!!!
    Sorry if this comes across a stupid question but it is new to me
    Chris      UK

    There's no "theory" about it. You should be able to open a raw file from bridge by double-clicking it, but it will open in ACR in PSE. You can't just use ACR within bridge in PSE, if that's what you're trying to do. To open a JPEG in ACR, go to file>Open in PSE and choose Camera raw as the format after you select the file but before you click Open.
    If you've correctly updated ACR, bridge should show you thumbnails of your raw files. If it doesn't try emptying the Bridge cache.

  • Photoshop CS2. Help please.

    Approx 8 years ago I purchased Photoshop CS2 online from Adobe. This past weekend I had to buy a new computer (Windows 8.1), and when I logged into my Adobe account just now to obtain my serial number and enter it after I attempted to download CS2, it said invalid serial number. Help please.
    Both tech support and the online chat person were not able to help me.

    The Activation Servers for CS2 and prior have been taken down. See the link below for an explanation and solution. Be sure to follow all directions, including using the new download serial number supplied on the page.
    CS2 and prior
    http://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.htm l
    --OB

  • I  used to have an OLD Photoshop cd but it has been lost and my program is no longer on cd. I talked with some photographer friends and this is what one of them told me to get: Adobe Photoshop Lightroom and CS CC... HELP please?

    I  used to have an OLD Photoshop cd but it has been lost and my program is no longer on cd. I talked with some photographer friends and this is what one of them told me to get: Adobe Photoshop Lightroom and CS CC... HELP please?

    If you still have your serial number, look at OLDER previous versions http://www.adobe.com/downloads/other-downloads.html
    Otherwise, the US$ 9.99 plan is what is current at Cloud Plans https://creative.adobe.com/plans

  • Creative live cam voice help please

    Help please,
    We are using the "live cam voice" model, with our computer (Vista 32bit), that appears to work OK, but after a few minutes we get the BSOD! We have tried un installing and re-installing drivers without any effect.Has anyone had this problem and if so how did you fix it.
    Regards,
    Arthur

    Thanks for your response. I have tried 3 ports so far, all with the same outcome. One of my sons had it happen to him on another computer (XP SP2) using this webcam . As to programmes open at the same time, I am not computer literate and have no idea what programmes were running on each occasion.We use the webcam for Skype and apart from that I may also have IE open and perhaps Outlook Express. Over and above those CS4 sometimes.
    If I cannot resolve this, can any one suggest another webcam please.
    Regards,
    Arthur

Maybe you are looking for