Can I avoid a FileNotFoundException when i run program on 1st time?

I did a google on theis exception and didnt find the help i need. I just want an example of avoiding this exception on a 1st run of program that has had no data saved or entered. Is there a method to see if the file exists?

What package i need to import? I have already imported the java.io wildcard package and the compiler cant find the exists() ? FileInputStream fis = new FileInputStream("PhoneBook.dat");
               if(fis.exists()){
                    ObjectInputStream os = new ObjectInputStream(fis);
                    phoneListRestore = (ArrayList<ContactDetails>)os.readObject();
                    os.close();
          }

Similar Messages

  • How can I get a display of all running programs in lion like I used to get when I did a 4 finger swipe in snow leopard?

    how can I get a display of all running programs in lion like I used to get when I did a 4 finger swipe in snow leopard?
    I liked to turn off running programs without a window that I was no longer using
    thanks.
    Best I can do now is to open the "force quit" window and click on programs I want to stop and then send each one a "command-Q" and then repeat as necessary
    Jeff

    Command + Tab is what you are after i think

  • Updated to Oct 2014 version of photoshop CC. since that time cannot save ANY work.  I can work on files but when I hit 'save as" every time it says "photoshop has quit working and needs to close."

    Updated to Oct 2014 version of photoshop CC. since that time cannot save ANY work.  I can work on files but when I hit 'save as" every time it says "photoshop has quit working and needs to close." Need solution now.

    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    etc.,
    someone may be able to help you (not necessarily this poster).
    a screen shot of your settings or of the image could be very helpful too.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • My iphone 6plus not working not charge but when i run it the first time working half an hour  when you attempt to run it again light up thr screen and showws the apple logo and after the pice screen illuminates red and does not work what do i do now

    My iphone 6plus not working not charge but when i run it the first time working half an hour  when you attempt to run it again light up thr screen and showws the apple logo and after the pice screen illuminates red and does not work what do i do now

    Hello Nadersalah,
    It seems you're experiencing multiple issue with your iPhone. Based on the information you have provided, it appears your iPhone needs to be serviced. The following link should help you get started with the process and has links with additional information on topics such as warranty and service pricing, battery replacement, and express replacement service.
    iPhone Repair and Service - Apple Support
    Thank you for contributing to Apple Support Communities.
    Cheers,
    Bobby_D

  • When I run this VI "Waveform Time to Date Time String" in LabView 7.0 it will not pass decimals of seconds.

    When I run this VI "Waveform Time to Date Time String" in LabView 7.0 it will not pass decimals of seconds. From decimals of inputline. If i disconnect the input to the subVI "Get Date/Time string vi" it will work propperly, it also doses if I reconnect it. I use LabViev 7.0.
    So the problem i solved, but i dosent understund why it works in this way. Does it indicate other problems which will make my researchprogram unrelaible ?
    Attachments:
    Waveform_Time_to_Date_Time_String.vi ‏18 KB

    Hello.
    I checked your vi and it fails as you state.
    It runs fine if: 1 Convert number to timestamp OR
    2 Wire a constant to want seconds?
    In labview 7.1, no problems.
    I think is a job for NI engeniers.
    Hope it helps
    Alipio
    "Qod natura non dat, Salmantica non praestat"

  • When i enter time machine with mail open can see past mail .  when i open iPhoto and enter time machine can not see past photos  have i got a problem  ????

    when i enter time machine with mail open can see past mail .  when i open iPhoto and enter time machine can not see past photos  have i got a problem  ????

    iPhoto '11: Restoring from Time Machine with iPhoto '11 (9.2 or later) and OS X Lion 10.7.2 (or later)

  • I can't make movie, case when i try do it all time paw disappear-

    I can't make movie, case when i try do it all time paw disappear and i can't drag over part of video than when i try do that again part of video drag over in the place where must be the following piece and remains at this place as I did not change screen and it did not switch the window....  Halp me.

    Apple - Support - Mac Apps - iMovie
    If the linked Support articles do not help you, the video tutorials below may:
    Apple Tutorial Videos
    If you are still having trouble, try to ask your question in different words
    or post it in your native language.  Someone here may be able to help you.
    Message was edited by: EZ Jim
    Mac OSX 10.8.5

  • Error when loging in sap the 1st time

    Hi
    I have installed sap 4.7 with oracle 8.1 gui6.4 under window server 2003.  When I log in the 1st time to create a client I am getting an error "BREAK statement not defined, check your seplling" in Program SAPLSHI1 in Module LSHI1U20 in line 203.  So I can not get to easy access screen.
    If anyone has encountered this problem, please advise how you resolved this problem.
    Thanks
    Akhtar

    There is no more support on Oracle 8.1 for more details visit service.sap.com/pam
    could you please try to upgrade your oracle from 8.1 to 92 or 10G
    Cheers,
    -Sunil

  • How can I avoid browser timeout when starting a Plsql procedure from Apex?

    I start a procedure when pressing a button in my Application Express form.
    This procedure take a while to run (about 10 min.)
    How can I avoid the browser to timeout with Error Code 1460: Timeout ?
    Is it possible to return to a page and let the procedure finish in the background. Or is it possible to get the Apex application sendig a message once in a while to keep the browser active?
    Thanks in advance.
    Evelyn

    In HTML DB 1.6, you could create page processes that would run as background jobs.
    Since 2.0, you can't directly select that option, but there's a work-around that may still work:
    Re: PLSQL DBMS JOB - Process Type

  • Unhandled exception when code runs for the first time,but works fine the second

    Hi All,
    I have the following code snippet
    private void RGL_Click(object sender, RibbonControlEventArgs e)
    Word._Document oDoc;
               oDoc = Globals.ThisAddIn.Application.ActiveDocument;
                object start = oDoc.Content.Start;
                object end = oDoc.Content.End;
                oDoc.Range(ref start, ref end).LanguageID = WdLanguageID.wdEnglishCanadian;
                oDoc.Range(ref start, ref end).NoProofing = 0;
    Microsoft.Office.Interop.Word.ReadabilityStatistic DocStats;
                    DocStats = oDoc.ReadabilityStatistics[10];------>exception occurs here when code runs first time
                    MessageBox.Show(DocStats.Name + " " + DocStats.Value);
    When I copy paste a document and click on the button it raises a COM exception but if I click continue and click on the button again, the correct grade level score is displayed.Cant figure out why this is happening.

    Thanks for the answer Eugene, this exception never shows up if I type something and click on the rgl button , but if i open a huge document that is already in Canadian english and click on this ribbon it gives me the following exception
    System.Runtime.InteropServices.COMException was unhandled by user code
      HelpLink=wdmain11.chm#36966
      HResult=-2146824090
      Message=Command failed
      Source=Microsoft Word
      ErrorCode=-2146824090
      StackTrace:
           at Microsoft.Office.Interop.Word.ReadabilityStatistics.get_Item(Object& Index)
           at UsabilityMapping_V01.Ribbon1.RGL_Click(Object sender, RibbonControlEventArgs e) in <my path> 1211
           at Microsoft.Office.Tools.Ribbon.RibbonPropertyStorage.ControlActionRaise(IRibbonControl control)
           at Microsoft.Office.Tools.Ribbon.RibbonPropertyStorage.ButtonClickCallback(RibbonComponentImpl component, Object[] args)
           at Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.Invoke(RibbonComponentCallback callback, Object[] args)
           at Microsoft.Office.Tools.Ribbon.RibbonMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
           at Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.System.Reflection.IReflect.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[]
    namedParameters)
      InnerException: 

  • How can I get adobe flash player to run without asking every time?

    Every time I go to a site that needs adobe flash player it asks if its ok to let it run. How do I make it run without asking every time?

    A possible cause is that you do not have the latest version of the Shockwave Flash player (16.0.0.305).
    You can check that in "Firefox/Tools > Add-ons > Plugins" ("Ask to Activate" or "Always Activate").
    You can find the latest Flash player versions for Firefox on this page:
    *http://www.adobe.com/special/products/flashplayer/fp_distribution3.html
    See also:
    *https://support.mozilla.org/kb/why-do-i-have-click-activate-plugins

  • Powershell Hang when using Run Program (2012 R2)

    I've seen a couple posts about this in the past but nothing recent. I am calling a powershell and passing through some variables to run program activity in orchestrator. The program runs (in this case the DB is created) and the script finishes, however the
    activity does not. I've tried two solutions:
    http://blog.coretech.dk/jgs/sco-2012-running-powershell-scripts-via-run-program-activity/
    and
    http://www.sc-orchestrator.eu/index.php/scoblog/67-running-powershell-with-the-run-program-activity-from-orchestrator
    Neither of which seem to do the trick. Here is my command
    Note: The script runs fine when called on the machine locally. For sake of cleanliness I've removed my <Nul 2>&1 attempts. 

    I have found in these situations that having a non-stop error seems to get it from freezing (along with <Nul 2>&1).  I use 'Get-Content "C:\Farce.txt"' as my last line.

  • I can not see my JPGs when i run my JSP

    Hello,
    I have a JSP which is called by servlet by RequestDispatcher. However
    when this JSP is run in browser I can not see the jpgs i put inside
    as banner or logo. (By the way, i can see them in JSP viewer, I mean inside tool) Those are all static images. Is there a procedure I should do in servlet or JSP to make them appear?
    Thank you very much..

    the only reason you don't see them is because the browser can't find them (in that case they'll appear as red crosses). Remember that the ultimate output is HTML and that should be correct.

  • How can I avoid Thunderbird timeouts when switching network connections?

    I'm using Thunderbird 24.4.0 but this problem goes back many releases.
    This problem happens when I switch from an external WiFi network to my company's internal LAN (ethernet).
    I'm connected to the company's email server via WiFi from home and can get and receive email no problem. I then turn off the WiFi, put the laptop to sleep, take it to work, wake it up, and plug in the Ethernet cable. I click on Get Mail and in the status bar at the bottom it says "Connecting to [servername] ..." and stays that way until I get a notification that Thunderbird timed out. I click on Get Mail again and this time it says "Connected to [servername] ..." and it gets my email. (It may have briefly said "Connecting to" prior to "Connected to" but I think I've only seen that once.)
    Why does it never work the first time but has to timeout before it will successfully connect, and what can I do to get it to connect without having to go through a timeout cycle?
    Thanks,
    --Steve

    Networking is an area of some frustration. Recently, some bug reports are seeing progress. The place to be to test these fixes is in development builds
    Note yet fixed:
    https://bugzilla.mozilla.org/show_bug.cgi?id=939318
    NetworkLinkService should be enabled so Necko can respond to network changes (not offline auto-detection)
    https://bugzilla.mozilla.org/show_bug.cgi?id=972262
    DNS cache is not flushed/re-initialized when toggling offline/online
    fixed in tb30:
    https://bugzilla.mozilla.org/show_bug.cgi?id=981513
    dns cache grace period error busting too aggressive
    https://bugzilla.mozilla.org/show_bug.cgi?id=981447
    dns cache too sticky!
    fixed in tb30

  • How can I avoid image 'distortion' when saving jpegs from Photoshop?

    I've created a logo with a transparent background and saved as an eps in Illustrator CS3.  To create a jpeg I then opened opened the eps in Photoshop CS3, set the resolution at 300ppi and then saved the image as a jpeg.  The image views ok on screen but when it is inserted into a word document and then printed, the background of the image is 'blurry' - it has small red dots through and you can see also the 'edges' of the image.  Not sure what I'm doing wrong!  Any help would be greatly appreciated.

    Thanks for all the ideas.  Had to have a jpeg at the 'clients' request so I couldn't use the .psd and .png options.
    I came across some info stating MS Word doesn't support CMYK jpeg which I did not realise.  So to solve the issue, I ended up opening the eps file as a Smart Object in RGB colour mode at the required resolution in Photoshop CS3 and then saving as jpeg.  The jpeg then printed perfectly after being inputted into a Word document - no blurriness or resolution issues.  I just had to advise the 'client' about the colour issues with RGB vs CMYK and not to use the jpegs for any professional printing.
    Thanks again.

Maybe you are looking for

  • PPR event getting previous value

    Hi There is a PPR event on a standard text box. I am handling PPR event in my custom CO. Whenever I change the value abd tab out of the text box I get the previous value not the current(changed) value. ExpenseReportLinesVORowImpl expensereportlinesvo

  • Multiple reads from DataInputStream through Socket

    Ok I got a small prob, and well, here it is: I have a server and a client. The client needs to send a file to the server. I'm using Data(Input/Output)Stream. I use writeLong() and readLong(), to send the size and after that read the size of the file.

  • LR2 vs Bridge+PS CS4

    I just upgraded from PS CS to CS4 and found Bridge was bundled in on the deal. At the same time, I also purchased LR2 since there was a major discount given if it was purchased at the same time as the upgrade. Mostly, I have been using Bridge + PS CS

  • Move flagged photos to the trash?

    Is there a way to move my flagged photos to the trash? I do not want them unflagged... I want them permanently gone from my library. Everytime I Command-A and move them to trash, it just unflags them and they're still in my library. Please help? /Tha

  • Popup window by javax.script. API, help

    Hello All, anybody did something like <h:commandButton id="errorpage" action="#{bean.errorPage}" value="Error Page" /> public void errorPage() {     try {       ScriptEngineManager factory = new ScriptEngineManager();       ScriptEngine engine = fact