Problem when application is closed using CTRL-C

When my app is launched it displays a JFrame and connects to a DB. In my GUI I have a windowClosing event handler and also a handler for a Disconnect button which will gracefully close the DB connection befor exiting.
However when a user executes from the Cmd prompt a CTRL-C command to kill the application ( for what ever reason ) the application has no way of closing any open DB connections. How can I get around this problem?

Hi,
Add a shutdown hook:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
It will execute when the jvm is about to terminate.
/Kaj

Similar Messages

  • ADF 10.1.3 : Saving VO results when application is closed.

    Hello,
    I have written to code to save the VO results in a file which i want to call when application is closed. So in which method should i call the code so that VO results are always saved irrespective of how application window is closed.
    Also i want to load the VO results into the VO when application starts, in which method should i do this?
    Regards
    Lokesh

    John,
    Thanx for the reply. Let me elaborate my requirement.
    My application is a web application. I have created a VO [not based on sql query]. This VO is populated by the user by providing various inputs on the application page. All i want to do is store these VO rows on the user file system when the user closes the application and then reload these rows back into the VO from the stored file when user reopens the application.
    Now i don't want to keep writing the rows on file system as soon as VO is populated as this would lead to bad performance, so i am looking to save the VO rows when application closes. Is there any way to do it??
    Regards
    Lokesh

  • When opening new tab, using ctrl, moving directly to the next tab

    when i open new tab using ctrl+left click it moving directly to the next tab, but i check the option menu then tab section, all sentence has a tick except the fifth one
    i can't remove this to the origin, and i uninstall firefox and reinstall it many time

    Tab mix plus https://addons.mozilla.org/en-US/firefox/addon/tab-mix-plus/
    also solves that problem, it has the option to focus the search box.

  • Problem when recording the data using BDC for Tcode CJ02.

    Dear Experts,
    When i am trying to record the data for TCODE : CJ02 i need to enter the project  Definition and enter the WBS element it takes me to the screen then i should select the WBS element and attach a file for that selected WBS element . The option for me to attach the attachment of file  will be available on the application area(Services for the Object).
    Now the problem when i try to do recording in SHDB this option like create attachement is not visible in the recodring . Kindly suggest me what can i do such that i attach the file for the particular project def and WBS element.
    Either suggest any function module or other procedure .......
    Regards,
    Sana.

    Hi,
      in BDC each and every action is recording. If your press enter in same screen that also recorded once aging may be this is your case repeating field values will appear. we can solve the problem for repeat fields like below.
    suppose in your excel having repeated field X1 X2 X3 the X2 contains repeated field X3 means delete the X3 field.
    Now In your itab having X1 and X2 fields. While in the LOOP the ITAB pass the X2 field to repeated the fields.
    LOOP at ITAB to WA.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'BDC_CURSOR'.
    bdcdata_wa-fval = 'RM08M-EBELN'.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'INVFO-BLDAT'.
    bdcdata_wa-fval = wa-X2." 1st time pass the X2 fields
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_wa-fnam = 'INVFO-BLDAT'.
    bdcdata_wa-fval = wa-X2." pass the same value to repeated field
    APPEND bdcdata_wa TO bdcdata_tab.
    Endloop.
    Hope you can understand.
    Regards,
    Dhina..

  • Javaw.exe is still running when application is closed

    The application works fine. when i close the application using "x" at the top of the window the javaw.exe is still running in task manager. javaw.exe is accumulating all memory when i run the again. The same problem occurs when i run the application through jar. Any help is appreciated

    If you use
    jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    and you close de window, all your applications
    running in the JVM will be closed too because System
    exit is used. I prefer to use
    jframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOS
    E);
    Alejandro H.If you had read the OP, he was complaining that the JVM was still running even though he had closed his application, which meant he wanted to stop the JVM.

  • Problems when downloading a file using jspsmartupload

    i am using jakarta tomcat 4.03 in linux ....
    to upload the file its ok .... im using this code here :
    String path = application.getRealPath("/upload");
    try {
    count = mySmartUpload.save(path);
    it works fine ......
    but when i try to download ..... putz .... its a f$##%#$% hell
    anybody knows how to download ???

    hi thr...
    see since i am using javawebserver i have a public html folder whr i have saved all the files which the site accesses . Now in the public html folder i have made a folder upload and i upload all the files to this folder.
    count = mySmartUpload.save("/upload/");
    Now for download use this ...
    <%@ page language="java" import="com.jspsmart.upload.*"%><jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><%
         // Initialization
         mySmartUpload.initialize(pageContext);
         // Download file
         mySmartUpload.downloadFile("/upload/sample.zip");
    %>
    this should work ...
    if this doesnt lemme know
    prob u r path should be ("/upload/")
    u have given as ("/upload"); try this 2 ... and do lemme knw

  • Problem when ObjectInput/OutputStream is used with GZIPStreams

    I am writing a Remort method invocation system as a part of a large project (Dont ask why I am re implementing the wheel of RMI RMI does not fit to my requirements)
    I am using ObjectStream to send method calls and receive return data I tried the use GZIPStreams to compress the data to minimize the network usage. But the problem is GZIPOutputStream does not send data to the underlaying Stream if I call flush in ObjectOutputStream which is at the top when the buffer of the GZIPStream is not full.
    So in the receive end just hangs. causing a dead lock.
    Setting the buffer to a very small size can fix the problem but it will reduce the performance so that option is out of the table
    How can I fix this problem Is their any compression streams which lets me to flush by force.

    Call finish() method of GZIPOutputStream
    But I had problem with GZIP . We cannot pass another object using the same stream after finish()

  • Problem when trying to convert using PDFG

    Hi,
    I'm trying to convert come files using PDFG. I tried the user console, the email account and the WebService API. None of this options worked.
    I can see in the log file that JBOSS is launched successfully, with every BMC being started without any error. The only problem that i have is taht QuartzService error but the Adobe support already told me that this was not a problem.
    When trying to submit a document for conversion, the log files registered the errors below. does anyone has some clue on this problem ?
    TIA,
    [code]
    2007-04-02 17:34:24,332 INFO [com.adobe.native2pdf.internal.DequeueBean] Retry enabled for Native conversion
    2007-04-02 17:34:24,348 INFO [com.adobe.native2pdf.internal.AESEngineBean] AES_1001: Begin processing job c27e1f-6c2951-465685-a7364b-845e2f-7ae0a1
    2007-04-02 17:34:24,566 INFO [com.adobe.service.ProcessResource] BMC505: Service WordConverterService: Starting native process with command line "C:\\Adobe\\LiveCycle\\jboss\\server\\all\\svcnative\\WordConverterService\\bin\\dll\\pdf gen.exe" PDF-WO3ff760003 -beginExecutable "C:\\Adobe\\LiveCycle\\jboss\\j2re1.4.2_04_compiler\\bin\\javaw.exe" -endExecutable -Xmx20m -cp "C:/Adobe/LiveCycle/jboss/server/all/svcnative/WordConverterService/bin/aaes-idl-bmc.jar; C:/Adobe/LiveCycle/jboss/server/all/svcnative/WordConverterService/bin/aaes-jaxb.jar;C:/Ad obe/LiveCycle/jboss/server/all/svcnative/WordConverterService/bin/adobe-bslj.jar;C:/Adobe/ LiveCycle/jboss/server/all/svcnative/WordConverterService/bin/AdobeCSA.jar;C:/Adobe/LiveCy cle/jboss/server/all/svcnative/WordConverterService/bin/AdobeCSAUtils.jar;C:/Adobe/LiveCyc le/jboss/server/all/svcnative/WordConverterService/bin/appmon.jar;C:/Adobe/LiveCycle/jboss /server/all/svcnative/WordConverterService/bin/commonbmc.jar;C:/Adobe/LiveCycle/jboss/serv er/all/svcnative/WordConverterService/bin/jaxb-api.jar;C:/Adobe/LiveCycle/jboss/server/all /svcnative/WordConverterService/bin/jaxb-impl.jar;C:/Adobe/LiveCycle/jboss/server/all/svcn ative/WordConverterService/bin/jaxb-libs.jar;C:/Adobe/LiveCycle/jboss/server/all/svcnative /WordConverterService/bin/jniw2.9.5_pdfmapi1.0.jar;C:/Adobe/LiveCycle/jboss/server/all/svc native/WordConverterService/bin/jniw2.9.5_word8.1.jar;C:/Adobe/LiveCycle/jboss/server/all/ svcnative/WordConverterService/bin/jniwrap-2.9.6.241.jar;C:/Adobe/LiveCycle/jboss/server/a ll/svcnative/WordConverterService/bin/namespace.jar;C:/Adobe/LiveCycle/jboss/server/all/sv cnative/WordConverterService/bin/winpack.jar;C:/Adobe/LiveCycle/jboss/server/all/svcnative /WordConverterService/bin/WordConverterServer.jar;C:/Adobe/LiveCycle/jboss/server/all/svcn ative/ServicesNatives2/jars/adobe-bslj.jar;C:/Adobe/LiveCycle/jboss/server/all/svcnative/S ervicesNatives2/jars/jacorb.jar" com.adobe.native2pdf.bmc.WordConverterServer -IOR IOR:000000000000002249444C3A636F6D2F61646F62652F736572766963652F4D616E616765723A312E30000 000000000020000000000000068000102000000000E3139322E3136382E31302E3130000DC8000000134A426F7 3732F42522D312F010000000000000000000000020000000000000008000000004A414300000000010000001C0 0000000000100010000000105010001000101090000000105010001000000010000002C0000000000000001000 000010000001C00000000000100010000000105010001000101090000000105010001 -AppServer jboss
    2007-04-02 17:34:24,676 INFO [STDOUT] Command line '"C:\Adobe\LiveCycle\jboss\j2re1.4.2_04_compiler\bin\javaw.exe"'
    2007-04-02 17:34:27,222 INFO [STDOUT] myOwnProcesses found 2
    2007-04-02 17:34:27,925 INFO [STDOUT] com.adobe.native2pdf.bmc.ConvertWord starting run()
    2007-04-02 17:34:28,315 INFO [STDOUT] com.adobe.native2pdf.bmc.ConvertWord calling execute
    Processing document 'C:\Documents and Settings\build_user\Local Settings\Temp\pdfg-build_user\c2\7e1f-6c2951-465685-a7364b-845e2f-7ae0a1\New Text Document.txt'
    2007-04-02 17:34:30,034 INFO [STDOUT] COM PID appears to be 5216
    2007-04-02 17:34:31,846 INFO [STDOUT] Running Word version 11.0
    2007-04-02 17:34:31,971 INFO [STDOUT] ConversionInterface returned status -2147467259

    Following the exception stack :
    Got default parameter bits 1c80017
    ConversionInterface returned status 0
    Read-Back ConversionInterface returned status 0, bits 1c00017
    JobOptions from file null
    2007-04-02 17:34:34,360 INFO [STDOUT] Working on doc New Text Document.txt
    2007-04-02 17:34:34,439 INFO [STDOUT] com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80004005; E_FAIL (Unspecified error)
    2007-04-02 17:34:34,439 INFO [STDOUT]
    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:624)
    at com.adobe.native2pdf.internal.wrap.acrobat7.pdfmakerapilib.impl.IPDFMakerDriverImpl.execP DFMaker(IPDFMakerDriverImpl.java:94)
    at com.adobe.native2pdf.bmc.ConvertBasePDFM.execPDFMaker(ConvertBasePDFM.java:438)
    at com.adobe.native2pdf.bmc.ConvertWord.convertViaPDFMaker(ConvertWord.java:179)
    at com.adobe.native2pdf.bmc.ConvertWord.execute(ConvertWord.java:66)
    at com.adobe.native2pdf.bmc.ConvertBase.run(Con
    2007-04-02 17:34:34,439 INFO [STDOUT] vertBase.java:82)
    2007-04-02 17:34:34,439 INFO [STDOUT] at java.lang.Thread.run(Unknown Source)
    2007-04-02 17:34:35,266 INFO [STDOUT] Sleeping before oleUninitialize
    2007-04-02 17:34:36,266 INFO [STDOUT] Calling oleUninitialize
    2007-04-02 17:34:36,282 INFO [STDOUT] Calling getProcessIdsByNonDefaultWindowStation()
    getProcessIdsByNonDefaultWindowStation() found 0
    2007-04-02 17:34:36,860 INFO [com.adobe.native2pdf.internal.AESEngineBean] AES_1002: Done processing job c27e1f-6c2951-465685-a7364b-845e2f-7ae0a1
    2007-04-02 17:34:36,860 INFO [STDOUT] com.adobe.native2pdf.bmc.ConvertWord shutdown JniWrapper
    2007-04-02 17:34:36,875 INFO [com.adobe.native2pdf.internal.DequeueBean] Message queued again into job queue
    2007-04-02 17:34:36,875 INFO [com.adobe.native2pdf.internal.AESEngineBean] AES_1001: Begin processing job c27e1f-6c2951-465685-a7364b-845e2f-7ae0a1
    2007-04-02 17:34:37,094 INFO [STDOUT] com.adobe.native2pdf.bmc.ConvertWord starting run()
    com.adobe.native2pdf.bmc.ConvertWord calling execute
    Processing document 'C:\Documents and Settings\build_user\Local Settings\Temp\pdfg-build_user\c2\7e1f-6c2951-465685-a7364b-845e2f-7ae0a1\New Text Document.txt'
    2007-04-02 17:34:37,297 INFO [STDOUT] COM PID appears to be 960
    2007-04-02 17:34:37,969 INFO [STDOUT] Running Word version 11.0
    2007-04-02 17:34:37,984 INFO [STDOUT] ConversionInterface returned status -2147467259
    Got default parameter bits 1c80017
    [/code]

  • What is the problem when opening jpg files using Desktop API

    Hi, i would like to open jpg, or gif files using Desktop API, and the application crashes.The Desktop API is supported by my OS, because txt files, or file directories can be opened, mails can be sent, browsing is also supported.
    Only jpg and gif, and i think other picture formats cannot be opened.
    Obviously ACDSee and other picture viewing programs are installed in my computer.
    The corresponding application code can be found at the bottom of the page of http://www.awprofessional.com/articles/article.asp?p=661371&seqNum=2&rl=1
    my code:
    if(Desktop.isDesktopSupported()){
    Desktop desktop=Desktop.getDesktop();
    try
    desktop.open (fileToOpen);
    catch (IOException ioe)
    JOptionPane.showMessageDialog (frame,
    "I/O problem");
    catch (IllegalArgumentException iae)
    JOptionPane.showMessageDialog (frame,
    "File doesn�t exist");
    fileToOpen is obviously a File.
    Thx for the help in advance.
    Message was edited by:
    javahelps
    Message was edited by:
    javahelps
    Message was edited by:
    javahelps
    Message was edited by:
    javahelps

    My file association for jpg files is correct, if i click on a
    jpg, ACDSee starts immediately.Although I am a long time Windoze non-user, I vaguely remember that there's a difference between correct file-type association being set and some application starting at a mouse click on a file icon. I also vaguely remember Windoze file-type association mechanism uses a few action-types. Java Desktop should expect a specific action-type for the association.

  • Audio Problem: When reproducing something "System" uses too CPU

    Hi everybody,
    I have a problem, as I writed in the title when I reproduce a video, a song, any sound, in the task manager I notice that the process "System" uses too cpu. I had this problem since the last sunday, but I didn't nothing! Saturday evening I hybernate my pc as usual. The next day I turned on the pc and I noticed the problem.
    After I noticed this problem I did an antivirus scan(a light one)(I use avast! antivirus) but it didn't find any virus, I tried to update Realtek drivers and the others, but nothing changed. I post here my pc model and everything you need.
    PC: Notebook HP G62 - 165 SL
    Operating system: Windows 7
    Here I post the task manager screen.[Click HERE]
    If you need further informations ask me for them.
    Sorry for my bad english 

    Let me know if it helps or not. I'll keep an eye out for your reply.  
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Problem when "Checking for Mail" using IMAP and POP

    Hello,
    I have an iPhone 3G running 2.0.1 and created 3 mail accounts (1 Gmail using IMAP, and 2 using POP).
    When I first set up the phone 2 days ago the installer copied the settings from my Mac and emails on my iPhone showed up correctly.
    Since yesterday something is screwed up because when I try to fetch new email I only see "Checking for Mail" at the bottom of the screen but nothing happens and new emails don't show up.
    Any idea how to fix this problem?
    Thanks!

    FYI you don't actually have to completely reboot the phone. From inside your email program, push and hold the HOME button for 7 or 8 seconds until it exits email and dumps you back at your home screen. That causes a hard-quit of the email program and will reset it. You should begin getting email again immediately after.
    Here's hoping Apple fixes that anomaly on their next release...

  • Problem when updating delivery quantity using 'BAPI_OUTB_DELIVERY_CHANGE'

    Hi experts,
    I have a requirement in which i need to update the material's delivery quantity in VL03N transaction.   For this im trying the BAPI
    'BAPI_OUTB_DELIVERY_CHANGE' and im passing the following values.
    HEADER_DATA : Delivery no.
    DELIVER : Delivery no.
    ITEM_DATA : Delivery no,
    item no,
    DLV_QTY quantity(changed),
    FACT_UNIT_NOM ( default to value '1')
    FACT_UNIT_DENOM ( default to value '1')
    ITEM_CONTROL : Delivey no,
    item no,
    CHG_DELQTY ( value "X")
    Then i use 'BAPI_TRANSACTION_COMMIT' for updating the changes. 
    Here the problem is, the BAPI is working fine for some quantity , say if i enter the DLV_QTY as 2 in ITEM_DATA, it is gettting updated.  But if i pass some other quantity , say 12, it is returning the folowing error.
    T ID                   NUM MESSAGE
    E VL                   363
    Pls tell why this error comes. and how to successfully update the delivery quantity for a set of material?
    Regards,
    Shanthi

    not answered

  • Problem when loading xml file using sql loader

    I am trying to load data into table test_xml (xmldata XMLType)
    i have an xml file and i want whole file to be loaded into a single column
    when i use the following control file and executed from command prompt as follows
    sqlldr $1@$TWO_TASK control=$XXTOP/bin/LOAD_XML.ctl direct=true;:
    LOAD DATA
    INFILE *
    TRUNCATE INTO TABLE test_xml
    xmltype(xmldata)
    FIELDS
    ext_fname filler char(100),
    xmldata LOBFILE (ext_fname) TERMINATED BY EOF
    BEGIN DATA
    /u01/APPL/apps/apps_st/appl/xxtop/12.0.0/bin/file.xml
    the file is being loaded into table perfectly.
    unfortunatley i cant hardcode file name as file name will be changed dynamically.
    so i removed the block
    BEGIN DATA
    /u01/APPL/apps/apps_st/appl/xxtop/12.0.0/bin/file.xml
    from control file and tried to execute by giving file path from command line as follows
    sqlldr $1@$TWO_TASK control=$XXTOP/bin/LOAD_XML.ctl data=/u01/APPL/apps/apps_st/appl/xxtop/12.0.0/bin/file.xml direct=true;
    but strangely it's trying to load each line of xml file into table instead of whole file
    Please find the log of the program with error
    Loading of XML through SQL*Loader Starts
    SQL*Loader-502: unable to open data file '<?xml version="1.0"?>' for field XMLDATA table TEST_XML
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file '<Root>' for field XMLDATA table TEST_XML
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file '<ScriptFileType>' for field XMLDATA table TEST_XML
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file '<Type>Forms</Type>' for field XMLDATA table TEST_XML
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file '</ScriptFileType>' for field XMLDATA table TEST_XML
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file '<ScriptFileType>' for field XMLDATA table TEST_XML
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file '<Type>PLL</Type>' for field XMLDATA table TEST_XML
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file '</ScriptFileType>' for field XMLDATA table TEST_XML
    SQL*Loader-553: file not found
    SQL*Loader-509: System error: No such file or directory
    SQL*Loader-502: unable to open data file '<ScriptFileType>' for field XMLDATA table TEST_XML
    please help me how can i load full xml into single column using command line without hardcoding in control file
    Edited by: 907010 on Jan 10, 2012 2:24 AM

    but strangely it's trying to load each line of xml file into table instead of whole fileNothing strange, the data parameter specifies the file containing the data to load.
    If you use the XML filename here, the control file will try to interpret each line of the XML as being separate file paths.
    The traditional approach to this is to have the filename stored in another file, say filelist.txt and use, for example :
    echo "/u01/APPL/apps/apps_st/appl/xxtop/12.0.0/bin/file.xml" > filelist.txt
    sqlldr $1@$TWO_TASK control=$XXTOP/bin/LOAD_XML.ctl data=filelist.txt direct=true;

  • 20.0.1: File== New Window & New Private Window will not open then Firefox will not stop running when application is closed

    Although nothing appears to be happening when clicking on either New Window or New Private Window there seems to be processes started because when I try to close Firefox and reopen, I get an error message saying that Firefox is already running. My only option then is to stop the processes via Task Manager. I have tried (several times) to uninstall and reinstall.

    Although advised not to, I finally hit the reset button in the Save Mode Window. This corrected the problem. I suspect a faulty add-on - I try and reject many. I will add them back on at a time as I develop the need. Thanks for you help.

  • Rendering Problem when printing to PDF using PDFCreator.

    When I print my report to PDF using PDF Creator it overlays the text over itself vs when i export to pdf and then print it prints it fine, can anyone enlighten me as to why it does this?

    Hi Raudel,
    According to your description, you can export the report to PDF and print it well. However, when you print the report directly to PDF with PDF Creator, fields are overlapping.
    Since you mentioned the report can display correctly after you export the report to PDF then print it, we can make sure the PDF rendering can work fine with reporting services. So it should not be the issue in Reporting Services. As we tested in our environment,
    when print the report directly to PDF with PDF Creator, report also display well. In your scenario, it supposed to be issue with PDF Creator. I suggest you contact the PDF Creator vendor to get some more effective advices.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu

Maybe you are looking for

  • Can't change email address in 4.0 Contact book

    I need to change my email address in the Sharing palette of the Contact book (as accessed from the Photo Browser).  When I highlight my address in the recipient list and then go to Edit, I get a message saying "This contact is used by a print recipie

  • Slow Sleep Wake-Up after Security Update 2014-002 MacBook Air

    Hello! I have a 2013 August MacBook Air. I experienced the "screen goes black, hard restart" issue for many months until one of the updates cured that issues, thank goodness. I just updated with Security Update 2014-002 and just noticed it took about

  • Clips lose pixel aspect ratio setting after relinking

    hi there, after reopening a project from a backup drive I had to relink all my media. no problem with that... but after relinking all aspect ratios were lost. files are 2048x1536 anamorph (manually) set to an aspect of 1.33 and then scaled down to 19

  • No commit item for the item

    hi, when i am creating purchase order against accoount assingnment group "K". i am getting an issue that it is saying "no commit item for the item 10 and the company code 1000' if i double click it it is saying that no cash maangement, funds maangeme

  • Renaming and copying files (Bridge CS3)

    Hi -- Scripting bridge, I am able to copy files using the copyTo(target) function. I also can rename files using the Javascript file.rename() function. But I am having trouble doing both in concert. If I rename before I copy, I lose the reference to