Save file with filechooser?

How do I save the selected file with my filechooser? I have created this sofar :
             JFileChooser gem = new JFileChooser("AliSys.script");
             gem.setFileFilter(filter);
             int dialog = gem.showSaveDialog(this);
             File fil = gem.getSelectedFile();
             if(dialog == JFileChooser.APPROVE_OPTION)
            }

no sorry... it didn't solve the problem, the file is still "emty":
             JFileChooser gem = new JFileChooser("AliSys.script");
             gem.setFileFilter(filter);
             int dialog = gem.showSaveDialog(this);
             if(dialog == JFileChooser.APPROVE_OPTION)
                 File fil = gem.getSelectedFile();
                  try{
                  FileWriter out = new FileWriter(fil);
                 }catch(IOException ioe){System.out.println(ioe);}
            }

Similar Messages

  • I can't open or save file with Java Web Start

    Hi,
    i can't open or save file with Java Web Start:
    import java.io.*;
    import java.util.*;
    public class MetaDataFileCreator {
    public String fileNameSpace = null;
    public String fileName = null;
    protected Properties file = null;
    public MetaDataFileCreator(String fileNameSpace, String fileName) {
    this.fileNameSpace = fileNameSpace;
    this.fileName = fileName;
    public void createMetaDataFile() {
    try {
    System.out.println("file METADATA");
    ClassLoader cl = this.getClass().getClassLoader();
    String nameFileMetaData = fileNameSpace + fileName + ".txt";
    FileOutputStream fileOS = new FileOutputStream(cl.getResource(nameFileMetaData).getFile());
    file = new Properties();
    file.setProperty("aaaaa", "aaaa");
    file.store(fileOS, "");
    fileOS.close();
    } catch (Exception e) {
    System.out.println("Error writing metadata-file: " + e);
    System.exit(1);
    e.printStackTrace();
    I have try also to open a file like this:
    ClassLoader cl = this.getClass().getClassLoader();
    file.load(cl.getResourceAsStream(nameFile));
    also like this:
    try {
    fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
    fss = (FileSaveService)ServiceManager.lookup("javax.jnlp.FileSaveService");
    } catch (UnavailableServiceException e) {
    fss = null;
    fos = null;
    System.out.println("Error with JNLP");
    System.exit(1);
    if (fss != null && fos != null) {
    try {
    // get a FileContents object to work with from the
    // FileOpenService
    FileContents fc = fos.openFileDialog(null, null);
    //FileContents newfc2 = fss.saveAsFileDialog(null, null, fc);
    // get the OutputStream and write the file back out
    if (fc.canWrite()) {
    // don't append
    os = fc.getOutputStream(false);
    } catch (Exception e) {
    e.printStackTrace();
    also like this:
    File f = new File((System.getProperty("user.home")+"x.txt").toString());
    FileOutputStream fileX = new FileOutputStream(f);
    OutputX = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fileX, "UTF8")));
    OutputX.println(....
    but it doesn't work with Java Web Start.
    Can someone help me?
    How can I open or save file?
    thank you.
    Sebastiano

    Did you specify <all-permissions/> in your JNLP file? Did you sign your code? What error are you getting?

  • How to save file with the "/" symbol in the name?

    Hi,
    I have Adobe Professional 8.  I need to save files with names that include the symbol /, but Adobe interprets, for example, A/88/6, as file name 6, in a folder named 88, in a folder named A, and sets up new folders to accommodate that.  I cannot substitute another symbol as I already have thousands of pdf files in a database using the / symbol, and I need them in the same folders.
    I would very greatly appreciate any advice,
    thanks,
    Mo.

    Thanks.
    As I said, I'm pretty ignorant about these things.  I wouldn't know how to begin using a "hack".  All I know is that I was able, for over a year, to save .pdf files directly from my browser on several computers, and use the forbidden "/" symbol in every file name.  After saving the files, Adobe will happily open them, and allow me to edit and re-save them, although I now see that it will not allow me to "save as" them under a different name without removing that symbol.
    I may not be tech-savvy, but I can state that everything I have said here and above is entirely accurate.  I would be happy to open a dropbox account to show you countless .pdfs with the symbol "/" in the name.
    This is honestly not that big a deal.  I greatly appreciate this discussion, and you have inspired me to become slightly less computer-ignorant.
    Hope you all had a great New Year.  I am still recovering.
    Cheers,
    Mo.

  • [svn:fx-trunk] 7661: Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.

    Revision: 7661
    Author:   [email protected]
    Date:     2009-06-08 17:50:12 -0700 (Mon, 08 Jun 2009)
    Log Message:
    Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.
    QA Notes:
    Doc Notes:
    Bugs: SDK-21636
    Reviewers: Corey
    Ticket Links:
        http://bugs.adobe.com/jira/browse/iso-8859
        http://bugs.adobe.com/jira/browse/utf-8
        http://bugs.adobe.com/jira/browse/utf-8
        http://bugs.adobe.com/jira/browse/SDK-21636
    Modified Paths:
        flex/sdk/trunk/templates/swfobject/index.template.html

    same problem here with wl8.1
    have you sold it and if yes, how?
    thanks

  • AppleScript open and save file with Numbers

    Hi all,
    I need to save an Excel .xls file as an .xls file in order to break the links that are included in the original Excel file. Since Numbers doesn't have any actions for Automator, I hoped someone could help me writing an AppleScript?
    It needs to open (Numbers) and all the .xls files that are added to a specific folder on my Mac, then save them to another folder as .xls (not .xlsx) and overwrite any existing files with same name. Since this all should work automatically, warnings and pop-ups that need a user to click an option are not allowed.
    Didn't think this could be too hard, but I'm just a noob when it comes to AppleScript. Help?
    Thanks in advance

    Check the attributes of the <textarea> tag. You can use wrap="no" or wrap="virtual" or wrap="hard" to define how the text area handles carriage returns.
    Brian

  • Word 2007 won't save files with Acrobat Pro 9.0 Installed

    Last night an issue started occurring while trying to save a document in MS Word 2007 (part of an Office Ultimate install).  After about 10 hours of trying several suggestions from a variety of forums and MS suggestions I found that the only time I cannot save a file by traditional means is when Acrobat is installed.  I tried updating Acrobate and had the same thing happen.  MS says all that's left for me to do is get an answer from Adobe (I have to wonder if it's a copout).
    Steps taken so far:
    Disabled the PDF add-in - still unable to save Word files
    Removed PDF add-in - still unable to save Word files
    Removed entire CS4 suite - Word was able to properly save files
    Installed only the parts of the suite that I use frequently (Photoshop, Soundbooth, Premiere, Acrobat) - unable to save Word files
    Removed Acrobat Pro 9.0 - Word saves files properly again
    When I say it will not save a file I've tried the keyboard shortcuts for Save/Save As, Choosing the Save/Save As from drop down, and even attempted to save by closing the document.  When prompted with the option to save changes I say yes and nothing will happen, I have to close the document with nothing saved.
    I hate the idea of reinstalling Acrobat each time I need to use it to keep Word functional.  I've seen a ton of threads on other forums related to this issue.  Has anybody else seen this or know about a fix/work around?  Any help is appreciated.  Please let me know if additional detail is necessary.
    The operating system for the affected computer is Windows 7 32-bit.

    I installed each update individually (6 of them) and rebooted after each update.  Opened Word and attempted to save a document (after each update/reboot), the documents still cannot be saved (previously created documents still cannot have new detail saved).
    Decided to delete the Office folder in the following path: C:\Program Files\Adobe\Acrobat 9.0\PDFMaker\Office
    Opened up word and Acrobat went through an installation processes, to replace what was removed I assume.  After this was done I attempted to save a document and was still unable to do so.  Went back and deleted that Office folder in the above path again.  When opening Word this time I cancelled the installation process that Adobe was trying to complete.  Preventing the install of the settings and PDF add-in allowed documents to be saved again in word.
    I decided to try to remove the innactive add-in from my Word Options and received the following error message:
    "The connected state of Office Add-Ins registered in HKEY_LOCAL_MACHINE cannot be changed"
    Due to my deleting that folder?
    I suppose I could cancel that installation that initiates each time I open Word (or any other Office program that benefits from Acrobat Add-ins) but that will be a bit of an annoyance.
    Anybody have another suggestion, know what may need to be deleted from the registry to prevent the Add-ins installation when opening Word, or know where that setting can be changed?
    Hopefully getting close to a resolution

  • Photoshop Elements 13 (Mac) Organizer - Can't save file with version sets.

    I have spent many hours now trying to get Elements Organizer to save Version Sets when I've edited a photo. I've tried more or less every little thing you can find online without any luck. But just moments ago I found that if I move the file to my desktop everything works just fine. I then tried to edit files in a few other folders (also imported to my Organizer) and found that when ever the folder was named to something with a nordic letter in it (å, ä, ö) then I couldn't save my file with version sets (option greyed out) but if I moved that same file to another folder, well then everything worked as it's suposed to.
    I'm using the trial version of PSE 13 for Mac (Yosemite) and the full version is ordered and on it's way. But if this problem can't be fixed, I need to return that order and buy some other photo editing program.
    Can anyone help me with this problem? Is there perhaps a solution to this?
    Please, any help is much appreciated!

    I'm using the English version (as more or less always - Swedish is rarely an option). The thing is that I have never encountered this problem before in any other software I've been using, and certainly not in Aperture that I've been using up until now.
    I name my photo folders with a date and a few words, for ex. "2014-12-31 New Years in Stockholm" (but I normally write in Swedish). I use this method so that my folder that contains the original photos will be easy to find in even without any other software than Finder (or Windows Explorer if I connect my external drive to a Windows machine). I could change the name of all of my folders, or at least all of the folders with a name containing one or more of the letters Å, Ä or Ö to "force" PSE to work as it should, but why? This really shouldn't be a problem.
    I was hoping that their was a simple option or something like that that could fix this issue, but I guess not.
    If this problem lies in the software itself I will have to return it and look elsewhere (but where? Lightroom is certainly not an option if Adobe can't handle "normal" letters and Aperture is discontinued in a few months).
    Thank you for your reply!

  • Save file with high resolution progamatically

    Hello,
    I'm trying to export the document to JPEG and PNG formats with a resolution of 300 DPI. I'm using the following code:
    PIActionDescriptor desc00000178 = NULL;
    error = sPSActionDescriptor->Make(&desc00000178);
    if (error) goto returnError; 
    PIActionDescriptor desc00000180 = NULL;
    error = sPSActionDescriptor->Make(&desc00000180);
    if (error) goto returnError;
    error = sPSActionDescriptor->PutInteger(desc00000180, keyExtendedQuality, 10);
    if (error) goto returnError; 
    error = sPSActionDescriptor->PutUnitFloat(desc00000180, keyResolution, unitDensity, 300.00);
    if (error) goto returnError;
    error = sPSActionDescriptor->PutEnumerated(desc00000180, keyMatteColor, typeMatteColor, enumNone);  
    if (error) goto returnError;
    error = sPSActionDescriptor->PutObject(desc00000178, keyAs,
    classJPEGFormat, desc00000180); 
    if (error) goto returnError;
    Handle aliasValue = NULL;
    FullPathToAlias("C:\\temp\\Myfile.jpg", aliasValue);error = sPSActionDescriptor->PutAlias(desc00000178, keyIn, aliasValue);
    if (error) goto returnError;
    error = sPSActionDescriptor->PutBoolean(desc00000178, keyCopy,
    true); 
    if (error) goto returnError;
    error = sPSActionControl->Play(&result, eventSave, desc00000178, plugInDialogSilent);
    if (error) goto returnError;
    returnError:
    if (result != NULL) sPSActionDescriptor->Free(result); 
    if (desc00000178 != NULL) sPSActionDescriptor->Free(desc00000178); 
    if (desc00000180 != NULL) sPSActionDescriptor->Free(desc00000180); 
    if (aliasValue != NULL) sPSHandle->Dispose(aliasValue); 
    return error;
    The file gets saved in the desired format but the resolution is always 72 DPI. Is there something i'm missing while exporting the file with higher resolution?
    Please help..
    Thanks

    Why are you adding a resolution value to the save command?
    It doesn't take or understand a resolution value.
    You need to set the resolution on the document first, then save.

  • Save file with script (skip warning 'modified outside Illustrator')

    Hi All,
    We all know that command:
    app.activeDocument.save();
    saves the document skipping all the dialogs and even alert that is popping out every time when you manually saving your file on a server:
    My issue is that I am working on PDF files (with preserved Illustrator editing capabilities) almost all the time rather than .ai files, and everytime I use
    app.activeDocument.save();
    The .ai file is created.
    My question is if it's possible to save PDF that you're working on same as you would manually 'Save' from the menu context, ommiting that annoying dialog about modified file?
    Regards
    Peter

    You should be able to "SaveAs",  specifying the PDF as the type and choosing to not invoke the dialog box.
    Hope this helps!  -TT

  • XFA form with button to save file with unique filename

    Is there a way to save a file with a unique filename using some data a user has entered (name, for ex.) that will fire when the user clicks a Print button? Attached is a file for reference.

    Yes, I'm getting close. With this
    var 
    vTargetName = Page1.dateStamp.rawValue + " HSS Foot & Ankle for Patient " + Page1.First_Name.rawValue + " " + Page1.MI.rawValue + " " + Page1.Last_Name.rawValue + ".pdf";
    var  
    vCurrentName = event.target.documentFileName.toString(); 
    if  
    (vCurrentName == vTargetName)app.alert("Thank you. Your form has been saved."); 
    else
    app.alert("There was a problem. Your form has not been saved.");
    I do get an alert when the PDF is saved. But if I modify the folder js to say var vPath = "/c/HSS/ instead of var vPath = "/c/HSSSave/ I don't get the alert "There was a problem." Do you see an error in the else condition?

  • Can't save file with futura font?

    Hi
    I'm having a problem saving a file that contains the futura font. This is a font my company had to buy. I never had a problem with CS1 or CS2 using this font.
    Once I place the font in the document it will let me save it once. After making changes and trying to save again I get a window that simply says "can't save file". I've tried unchecking the pdf compatible option and the compression option with no change.
    I found one thread on this site about clearing out the font cache (by deleting the file C:\windows\system32\FNTCACHE.dat) and that didn't make a difference.
    When I'm done with the document I'll be converting the text to outlines but I need a fix will I'm working on the doc.
    Thoughts?

    Mike,
    Glad you got it sorted out. After I sent you back the regenerated fonts, I discovered something which I'm posting here for everyone's benefit.
    Myle nailed it when he suggested an "an issue with font embedding." The fonts you sent me were all embedding-restricted. It's possible you could have saved your documents had you turned off the PDF compatibility option, but it's moot now.
    It's doubtful the fonts I regenerated for you will solve the problem because putting them through my font editor did not remove the embedding restriction. I would bet dollars to doughnuts that your replacement fonts do not have embedding restriction.
    To check for the embedding restriction, you don't need a fancy program. Just download this Windows extension from Microsoft and install it. Then, right-click | Properties on any font file will give you a lot more information about that font, including licensing/embedding restrictions.

  • Open file - Search word - Copy word - Save file with word found

    I have a little problem:
    1 .- I need to open a name.pdf
    2 .- Search (Find) for a word 2009NNNNNN
    3 .- Copy 2009NNNNNN
    3 .- Save the file with your name_2009NNNNN.pdf
    Can you help? Thanks
    ''WHY NOT WORKING''
    SendKeys "+^(F)" ' lanzo la secuencia ''buscar'' mediante mayúsculas (+) , control (^), y la letra F
    SendKeys "200911111" ' lanzo la búsqueda de la parte del fichero 200911111
    Application.Wait Now + TimeValue("0:00:05") ' hago una pausa
    SendKeys "{ENTER}" ' lanzo la tecla intro con la cadena {ENTER}
    SendKeys "^(c)" ' copio la cadena que por defecto se marca al completo ejemplo 200911111***
    SendKeys "+^(s)" ' inicio el salvado del fichero
    Application.Wait Now + TimeValue("0:00:05") ' hago una pausa
    SendKeys "{END}" ' me posiciono al final del nombre del fichero
    Application.Wait Now + TimeValue("0:00:05") ' hago una pausa
    SendKeys "{LEFT}{LEFT}{LEFT}{LEFT}" ' Me pongo justo delante del punto del pdf osea .pdf
    SendKeys "(_)"
    SendKeys "^(v)" ' Pego la cadena anteriormente buscada
    Application.Wait Now + TimeValue("0:00:05") ' hago una pausa
    SendKeys "{ENTER}" ' Pincho intro para guardar
    Application.Wait Now + TimeValue("0:00:05")
    SendKeys "^(q)" ' Cierro la ventana del .pdf
    http://www.ayudaexcel.com/foro/macros-y-programacion-vba/2785-extraer-dato-de-un-archivo-p df.html#post12531

    ¡Tanks!
    I understand that you ask me, I want. If,
    I want the search interface of the word and what needed to carry out the program.
    I do not know where to download the programming manual for Adobe. Do you know?
    Thanks for answering
    Entiendo que me preguntas, qué quiero yo . Si,
    quiero la interfaz de búsqueda de la palabra y aquello necesario para realizar el programa.
    No sé dónde bajar los manuales de programacion para el Adobe. ¿Tu sabes?
    Gracias por contestar

  • Photoshop wont let me save files with Extensions...

    Photoshop isn't letting me save my files with extensions any more. It's only saving files as copy's and I have to add the extensions manually. This happened around the time I updated to OSX maverics, and is driving me crazy as it is extremely time consuming. I'm using CS5 version. Please Help!!

    Thankyou! That worked to fix the file extensions part of the problem. I had somehow changed it to "never "instead of "always".
    I'm still having the error message problem that photoshop is forcing me to save the file as a copy though. See the attached photo for the error message I'm receiving.
    Do you know how to fix this? So that I can save work to the original image?

  • Crertifiacte download in Safari Browser saves file with CGI name

    We need to download user certificate in FireFox and Safari browsers as a multiple MIME message.
    ---- Sample MIME message template - START ----
    Content-Type: multipart/mixed; boundary="ABABABABABAB"
    --ABABABABABAB
    Content-type: application/x-x509-user-cert
    <cert_blob binary here>
    --ABABABABABAB
    Content-Type:text/html
    <HTML content here>
    --ABABABABABAB--
    ---- Sample MIME message template - START ----
    In FireFox the certificate gets downloaded and installed properly.
    In an ideal world BROWSER should handle "Content-Type:
    application/x-x509-user-cert". Browser should recognize that a user
    certificate is being downloaded and provide steps for user to install.
    But Safari browser prompts user to save the file, where filename is same as the CGI. If you choose “Download”, you will be prompted to install certificate into KeyChain. Displaying the filename as CGI is bit odd and confuses end user.
    How this can be fixed. Why the end user experience is different than Firefox.
    Filename can be changed by using Content-Disposition: HTTP header, but then it would require to have different pages for Safari and Firefox.
    Any input is appreciated.
    Thanks

    hi..
    1. yes i am able to log the file name properly on the server side. Whatever name i use, in whatever language, its showing correctly on server logs.
    2. the content of the file is variable with japanese, english or any other language
    3. in firefox, the name is converted to ascii characters... a combination of asterix, underscores, letters and others.
    4 No i am not getting an exception.....the file isdownloaded with the kindof name i mentioned in above point but the contents are intact. So the contents of file really dont matter in this case. its only the name that is giving a problem.
    I found a solution which was by modifying the content-disposition field of the header. For firefox, it should be something like
    response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0.");
    where the numbers are the hex representation of the filename in bytes. ie
    byte[] utfName = filename.getBytes("utf-8");
    String nameToSend = /*Hex represenation of utfName with each hex character appended by % */
    This method is working in firefox but not IE. Now i need to get this sorted on that.
    ny help...

  • Save File with Field data plus append more information

    I am looking to create a button that will save a button and append the data from a field to it when I save it.  So it would be a click event in javascript and inside the "saveFile" information would append TextField1 and "some text I make up" which would create the saved file name.

    Hi There
    Not sure if you have sorted this.
    But I would achieve this using the trusted function
    create your form as usual
    then create an extra subform and make it in to a save as box (just add a textfield and some text and a button)
    have the save button on the form simply call the saveas subform
    saveas.presence = "visible";
    then the button on the saveas subform have the following code (under click event in javascript) 
    saveas.presence = "hidden";
    event.target.saveasFunc();
    to get this function to work you need to create a .js file using notepad with the following code
    saveasFunc = app.trustedFunction(function () {
    app.beginPriv();
    var text1 = event.target.xfa.resolveNode("form1[0].saveform[0].TextField1[0]").rawValue;
    var text2 = event.target.xfa.resolveNode("form1[0].saveform[0].saveas[0].TextField2[0]").rawValue;
    try {
    event.target.saveAs("/c/forms/" + text1 + " " + text2 + ".pdf");
    } catch (err) {
    app.alert("Error: " + err);
    app.endPriv();
    Obvisously setting the targets correctly and the save directory
    then save this file as any name you like .js e.g. (saveas.js) then place this file in the c:\program files\adobe\acrobat\javascripts, or similar but with reader if using adobe reader.
    If you intend to use this file in reader then you will need to enable extended features in reader on the file using Adobe Acrobat.
    OK the above is only availble where you have the ability to load the .js file in to the correct directory.
    I used it by creating a simple installation file which placed the .js file in teh correct directory and the form ont eh end users computer.
    It may or may not work for you.
    If I can be of any further help let me know.

Maybe you are looking for