Image constructors doesn't close the file

is that intended?

here is code:
package javafxapplication7;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public class Sample implements Initializable {
    @FXML private ImageView imageView;
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        try (InputStream is = Files.newInputStream(Paths.get("Company.png"))) {
            Image img = new Image(is);
            imageView.setImage(img);
        } catch (IOException ex) {
            Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, null, ex);
    @FXML private void buttonAction(ActionEvent event) {
        try {
            imageView.setImage(null);
            Files.delete(Paths.get("Company.png"));
        } catch (IOException ex) {
            Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, null, ex);
}this works fine. when i ckick the button img file is deleted.
package javafxapplication7;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public class Sample implements Initializable {
    @FXML private ImageView imageView;
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        Image img = new Image("Company.png");
        imageView.setImage(img);
    @FXML private void buttonAction(ActionEvent event) {
        try {
            imageView.setImage(null);
            Files.delete(Paths.get("Company.png"));
        } catch (IOException ex) {
            Logger.getLogger(Sample.class.getName()).log(Level.SEVERE, null, ex);
}with this code when i click the the button i get
java.nio.file.FileSystemException: Company.png: The process cannot access the file because it is being used by another process.

Similar Messages

  • Is there some way to add multiple addresses to an email I am sending that doesn't close the contact list after I click on an address?  This necessitates constantly going back to click the + sign to add each address separately.

    Is there some way to add multiple addresses to an email I am sending that doesn't close the contact list after I click on an address?  This necessitates constantly going back to click the + sign to add each address separately.  Is there some way I can open the contact list, click on all of the individual addresses to which I want to send the email without the list closing between each address entry, and have all of my address entries be listed to the email at one time?  Something like it works in Gmail.  I do not want to use set lists, I want to enter different addresses each time I send an email.  And I am a very slow typist, so I don't want to type the first few letters of each recipient's name.  It is much faster for me to just click on the e-mail addresses in the list as a group.  It doesn't make any sense to me to have to reopen the contact list for each address, when it should be so easy to click on all of the addresses I want at one time and then click once to add them all to the email as a group.  If there is a solution to this, please tell me.  Thanks.

    Vatlily,
    Try this:
    1. Select Mail>File>New Message.
    2. Select Mail>Window>Address Panel.
    3. Use (command+click) on the desired addressees in the Address Panel to create the list.
    4. Click "To:" on the top left of the Address Panel.
    The group that you selected will be added to the "To" field in your New Message.

  • APD - I'm trying to send a File to AS but 'Could not close the file 'AP_DP'

    Dear Expert,
    I'm trying to sen a file to Application Server through Analysis Process Design, but the messega that the log show is:
    Could not close the file 'AP_DP'; operating system error: 9 (Bad file descriptor)
    I have three compoent in the analysis process:
    DataSource:
    Query
    Transformation:
    Hidden Column
    Aggregation
    Data target:
    A PC file.
    When a activete and execute the file doesn't save in the Application Server.
    Please give some advise regarding this case,
    Thanks for your time,
    Luis

    We have authorization problem, restric by OHD technical name.

  • AI plugin: When I try to close the file( not Illustrator), after I save, I've to close it manually.

    HI All,
    I use AI plugin- custom defined. When I try to close any AI file after I edit(without saving it), it gives me a pop-up saying "Save changes to AI document "xxxx.ai" before closing?" with three options- Yes, No or Cancel. If I click on "No" or "Cancel" it behaves normally(as expected) and when I click on "yes", it saves the file but doesn't close it. I have to close the file again, which is not the expected behavior. Please help me....

    This isn't an answer to your question, but rather some general debugging tips to use with the Illustrator API.
    First of all, almsot every API call returns an AIErr value.
    You can start to debug this code with
    AIErr error=kNoErr;
    AIDocumentHandle doc;
    error = sAIDocument->GetDocument(&doc);
    if(error)
      //There was a problem in the GetDocument call.  Inspect the value of 'error' to see which error it reports.
    error = sAIDocumentList->Close(doc);
    if(error)
      //There was a problem in the Close call.  Inspect the value of 'error' to see which error it reports.
    I wouldn't recommend it except when debugging because the API may change between versions, but the Handle classes are all pointers, so you can initialize them to zero.  Then, you should be able to see if GetDocument is changing doc and whether your error is from using -> with an uninitialized pointer.

  • ORA-27045: unable to close the file

    I have found distinct ora error in alert log file, i can rectify what this error is all about
    Thu Jan 17 00:18:58 2008
    Errors in file /oracle/BP3/saptrace/usertrace/bp3_ora_13476.trc:
    ORA-27045: unable to close the file
    SVR4 Error: 5: I/O error
    TRACE FILE INFO
    Dump file /oracle/BP3/saptrace/usertrace/bp3_ora_13476.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning and Data Mining options
    ORACLE_HOME = /oracle/BP3/102_64
    System name: SunOS
    Node name: DSS-BWDB
    Release: 5.10
    Version: Generic_120011-14
    Machine: sun4u
    Instance name: BP3
    Redo thread mounted by this instance: 1
    Oracle process number: 168
    Unix process pid: 13476, image: oracle@DSS-BWDB (TNS V1-V3)
    *** 2008-01-17 00:18:58.417
    *** SERVICE NAME:() 2008-01-17 00:18:58.391
    *** SESSION ID:(698.4119) 2008-01-17 00:18:58.391
    ORA-27045: unable to close the file
    SVR4 Error: 5: I/O error
    Additional information: 3
    Can anyone what is wrong, is this a fatal error?
    Thanks
    Jafar

    This is an OS related error, particularly IO. This could be a damaged disk sector or a disk array failure. You should proceed with caution and have your backup handy. Please check OS physical storage health.
    ~ Madrid

  • I have a family video DVD that was originally on tape, but is now on disc. I want to import it onto my MacBook to edit and store. However the files are IFO, BUP and VOB and the Mac is saying 'unable to import' as it doesn't recognise the file. Help !!

    I have a family video DVD that was originally on tape, but is now on disc. I want to import it onto my MacBook to edit and store. However the files are IFO, BUP and VOB and the Mac is saying 'unable to import' as it doesn't recognise the file. Help please !!!!!

    Those are the constituent parts of a standard mpeg2 DVD. Storing them is easy: just copy the folder to your hard drive and they will play in DVD player or VLC.
    But that format is not intended for editing. To do so:
    You need to convert the VOB files in the TS-Folder of the DVD back to DV which iMovie is designed to handle. For that you need mpegStreamclip:
    http://www.squared5.com/svideo/mpeg-streamclip-mac.html
    which is free, but you must also have the  Apple mpeg2 plugin :
    http://store.apple.com/us/product/D2187Z/A/quicktime-mpeg-2-playback-component-f or-mac-os-x
    (unless you are running Lion in which case see below))
    which is a mere $20.
    Another possibility is to use DVDxDV:
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.overview.htm
    which costs $25.
    For the benefit of others who may read this thread:
    Obviously the foregoing only applies to DVDs you have made yourself, or other home-made DVDs that have been given to you. It will NOT work on copy-protected commercial DVDs, which in any case would be illegal.
    And from the TOU of these forums:
    Keep within the Law
    No material may be submitted that is intended to promote or commit an illegal act.
    Do not submit software or descriptions of processes that break or otherwise ‘work around’ digital rights management software or hardware. This includes conversations about ‘ripping’ DVDs or working around FairPlay software used on the iTunes Store.
    If you are running Lion:
    From the MPEG Streamclip homepage
    The installer of the MPEG-2 Playback Component may refuse to install the component in Lion. Apple states the component is unnecessary in Lion onwards, however MPEG Streamclip still needs it. See this:
    http://support.apple.com/kb/HT3381
    To install the component in Lion, please download MPEG Streamclip 1.9.3b7 beta above; inside the disk image you will find the Utility MPEG2 Component Lion: use it to install the MPEG-2 Playback Component in Lion. The original installer's disk image (QuickTimeMPEG2.dmg) is required.
    The current versions of MPEG Streamclip cannot take advantage of the built-in MPEG-2 functionality of Lion. For MPEG-2 files you still need to install the QuickTime MPEG-2 Playback Component, which is not preinstalled in Lion. You don't have to install QuickTime 7.

  • Double clicking on a file launches the app but doesn't open the file anymore. Why?

    Double clicking on a file launches the app but doesn't open the file anymore. Why?

    I would post in the Illustrator forum here http://forums.adobe.com/community/illustrator or the Dreamweaver forum here http://forums.adobe.com/community/dreamweaver. One of these product forums will be able to help.

  • HT3775 I am trying to open a .mov file in "Quicktime" and it keeps saying it doesn't support the file.

    I have made a movie in "Final Cut Pro X" saved it as a .mov file and "QuickTime" won't open it. It keeps saying that it doesn't recognize the file. Ironically there is another .mov file right next to it on the flash drive that opens just fine. I do notice that the one it does open looks like a little black box with a 'play' arrow button in it when I run the curser over it, but the one it doesn't open has a 'Quicktime' 'Q' in it.
    I try to eject the flash drive and it says "Final Cut Pro X" is still using it, then it shows me a window that shows 6% progress. I am thinking maybe the movie is still loading. I really don't know.

    Try VLC.

  • In Illustrator, I have a saved artwork, then I'm saving a copy as PDF, as usual.  After I keep the AI file open, making some modifications which I don't want to save, so I close the file and click "Don't Save".  Even though I clicked that, the file's modi

    In Illustrator, I have a saved artwork, then I'm saving a copy as PDF, as usual.
    After I keep the AI file open, making some modifications which I don't want to save, so I close the file and click "Don't Save".
    Even though I clicked that, the file's modification time is changing.
    (The modifications I made are not there, so it's not really saving but why the date is changing then?)
    Please find the cause of it! Thank you!

    All I can suggest is that you open that file on the MBA and save it as a new file, then see if you can open the new one on the iMac.

  • I'm trying to e-mail music scores and audios, but I receive an error message saying Preview doesn't recognize the file format, regardless whether I use .mus, .pdf, or .mp3.  I haven't come across Preview or this problem before.  Any suggestions?

    I'm trying to send music, scores and audio, as e-mail attachments, with a copy to my e-mail address.  Whether I use .mus, .pdf, or .mp3, the error message says Preview doesn't recognize the file format.  I haven't seen Preview, or had any problems, before now.  Thanks for any suggestions.

    Hi,
    Firstly, your country is detemined by several factors, including your phone's regional settings, your SIM card and your NokiaAccount settings, if you used this phone whilst abroad then you may need to check that your regional and account settings are up to date since you have arrived in Canada.
    For services like Gigs, you should also ensure that the MixRadio app has access to your phone's GPS location as well as the main location being on in the phone settings. To check this, as well as Location being turned on in the phone settings, in MixRadio itself go to Settings>Location>On:
    The concern with favourites may also be related to location, if the music from certain artists is available in Canada but not where the service might think you are, availability of content may vary from region to region.
    If all settings in both the phone, your Nokia Account and the MixRadio app are correct, we may have to investigate deeper.
    It is impossible to comment on your camera without seeing it, you cold have the phone checked by Nokia Care locally, but of course if it was supplied in Europe it will be covered by the European Limited Warranty which is not valid in Canada.
    If this or any post answers your question, please remember to help others by pressing the 'Accept as solution' button.

  • When you double click on psd new instance of Photoshop opens but it doesn't open the file

    Just updated to new version of Photoshop and when I double click on a psd, a new instance of Photoshop opens but it doesn't open the file.
    Any way to fix this?

    If I use open from Photoshop it opens the file.  If I drag and drop into photoshop(and there is nothing open in photoshop) is opens.

  • Adobe won't open Firefox 4, says it doesn't recognize the file type. Help?

    After the first try, I updated Adobe to the latest version, but it still doesn't recognize the file type of Firefox 4.0

    Hello,
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • Ctrl+S and file save just get ignored and I have to close the file to save docs

    I am using DW CS5.5.
    Ctrl+S and file>save just get ignored and I have to close the file to save docs.
    Any ideas? Thanks

    "If this configuration folder is the one in the Program Files hierarchy, you may have shot yourself in the foot.  Never mess with those."
    I had a neighbor one time who was annoyed that "that darn bolt on the bottom of my engine" kept scraping on the curb when he'd pull in or out of his driveway, so he ground it down till it was flat with the oil pan. It wasn't till about a year later when he took the car in to have the oil changed that he realized the error of his ways. Cost him $500 to have the pan pulled and replaced.
    If you don't know what it does, find out first or leave it alone.

  • Cannot open CS6, it craves JBX-plugin, and my Mac doesn't recognize the file so I can't download

    I wonder why CS6 is not complete when downloaded? Why should I have to download JBX? If needed it should be a part of Indesign. My Mac doesn't have a name of a file to open and download, so now I simply don't have CS6 and can't convert my book to Kindle for sales on Amazon.
    Terribly disappointed!
    /maria

    I am using OS X 10.9.2 and I'm attaching the error message I get. I am
    trying to install InDesign CS6 in order to convert my book to Kindle, but
    Amazon's plug-in only works with InDesign CS6 NOT with InDesign CC.
    I am attaching the Kindle Plugin also.
    2014-05-07 22:19 GMT+02:00 Jeff A Wright <[email protected]>:
        Cannot open CS6, it craves JBX-plugin, and my Mac doesn't recognize
    the file so I can't download  created by Jeff A Wright<https://forums.adobe.com/people/JeffAWright>in *Creative
    Cloud Download & Install* - View the full discussion<https://forums.adobe.com/message/6363126#6363126>

  • I can't import Nikon NEF (RAW) files.  It says it doesn't recognize the file.  Help.

    I just installed Nikon Transfer and then View NX2 with Nikon Transfer 2 and successfully transferred over 300 RAW (Nikon NEF) files from my camera (Nikon D600) but Lightroom (v5.6) won't import them.  It says it doesn't recognize the files.  How can I resolve this?

    Obsolete versions of Nikon software corrupt Nikon raw files slightly making them unrecognized in Adobe products.
    You can reverse this corruption by using the utility from the following webpage:
    http://owl.phy.queensu.ca/~phil/exiftool/fix_corrupted_nef.html
    Basically you need to use Nikon software that is at least as new as your newest camera or don’t use Nikon software at all.

Maybe you are looking for

  • Update form when table is updated

    Hi experts, I am quite new to apex and i have come across an issue. I have created a table with 10 columns and from that created a form/report.i have to update my table by adding new columns but i can't get my report updated. i have manually included

  • Remove trusted cert from cert store

    Hi, actually I think about a problem with a signed applet that contained a flaw. Of course the users have most probably already set the certificate to "always grant" when they first used the applet. I know that I can remove the cert from the store wi

  • Adobe Pro XI; expandable answer box

    I have Adobe Pro XI; and I am trying to make it so my answer box expands as needed.  I've tried clicking on multi-line and scroll long text but entered data goes off screen and does not printAdobe Pro X

  • HT4906 why can i not turn on photo stream on my mac which has OS X 10.7.4?

    Why does my Macbook Pro with OS X 10.7.4 not allowing me to check the photostream box in icloud, under the System Preferences tab? It just allows me to chose "learn more."

  • Graphe XY ne veut pas se connecter à un terminal pourtant correct

    Bonjour, je veux afficher une courbe sur un graphe jusqu'ici rien de bien compliqué, le soucis est que le graphe XY ne veut pas accepter mon talbeau alors qu'il est au bon format. C'est un probléme qui a déjà du être traiter mais j'ai pas réussi à le