How I launch an external program and kill the father?

my objective is that a jar file autoupdate himself with other jar file.
I must delete old file and replace with a new one, but it is imposible if it is running.
I think launch auxiliar application to do the work but when I use "Runtime.getRuntime.exec("....")" first program does not finish if the second one is not finished.
Also I tried with "Runtime.getRuntime().exec("cmd /c calc.exe");" and using Threads "setDaemon(true)", but does not work, daemon thread dies when first program finish.
Any idea?
thanks

Hmmm... We've done similar in a VB app... We wrote a "facade" program which looked like the actual product (icons, splash screen, etc) but was in-fact an automatic self-updater.
1. Show splash screen
2. Fetch a "config" file from the server, which tells us the latest version of each component (including the self-updater).
3. If this updater needs updating, download it, exec a batch script and terminate this process... the batch script just renames file updater.new updater.exe and starts updater.exe --> goto step 1.
4. check if the installed product components are up-to-date.
5. download new/updated components and install them.
6. start the actual application.
If I recall, there was no problem with exec'ing a new process and not waiting for it to end in VB... and I'm not getting your problem in java... this launches notepad and the program terminates... be very careful with anything which could write to either standard stream... the child will block when it's output buffer gets full.
class DodgyLauncher
  public static void main(String[] args) {
    new Thread(new Runnable() {
      public void run() {
        try {
          Runtime.getRuntime().exec(new String[] {"cmd", "/c", "notepad.exe", "DodgyLauncher.java"});
        } catch (Exception e) {
          e.printStackTrace();
    }).start();
}Cheers. Keith.

Similar Messages

  • HT5548 I upgraded one of my programs and now the old and new both appear on launch pad, and I can't delete the old one.  Is there a way I can do that?

    I upgraded one of my programs and now the icons for both old and new appear on the launch pad.  I don't need or want the old version to display, as it's been imported into the new one.  I can't seem to figure out how to edit it off the launch pad.

    Hi there,
    More then likely, the old version was installed independently from the App Store. The article below goes over the process for removing these application.
    OS X Lion: Install, update, and uninstall apps
    http://support.apple.com/kb/ph4524
    To uninstall other apps, drag the app to the Trash (the Trash is located at the end of the Dock), and then choose Finder > Empty Trash.If you change your mind, before emptying the Trash, select the app in the Trash, and then choose File > Put Back.Warning: When you empty the Trash, the app is permanently removed from your computer. If you have any files that you created with the app, you may not be able to open them.
    Hope that helps,
    Griff W.

  • How can I download my iMac iTunes library to an external drive and reload the library to iTunes on a PC?

    How can I download my iMac iTunes library to an external drive and reload the library to iTunes on a PC?

    Hi Niel.  Can you be move specific for those of us not tech savy?   1 - Can you provide steps to back up the library?  2 - How do you organize the library?  3 - When you move the entire iTunes folder, does it include iTunes paid for music along with downloaded music from CDs?  Thanks

  • When copying Itunes to an external drive, how do I get iTunes to feed from the file on the external drive and not the computer/

    I've already copied my iTunes folder onto my external hardrive. I'm having problems getting iTunes to pull the information from the external hardrive and not the computer's internal one, though. Any suggestions on how to get it to work?

    iTunes works off of an ITL file in the iTunes folder
    instead of dragging the folder out of the external hardrive and onto the desktop just do this
    -hold shift key and double click iTunes to open it up
    -you will get a prompt asking to create a new library or choose library, click choose library
    -an explorer window will open up and you are going to navigate to the external hard drive and open the iTunes folder
    -in the iTunes folder you are going to find a file that doesn't look like a folder but a page with a corner folded on it that is your iTunes library file
    -double click the iTunes library file and your library will appear and you are good to go
    WARNING: this is a good method for making sure your music doesn't take all of your computer's storage but keep in mind if you remove the external hard drive from the computer you may have issues accessing the library example next to the song titles

  • I partitioned a small drive for a windows program, and now the computer only wants to boot to Windows.  How do I get back to Mac so I can have a choice of drives?

      I partitioned a small drive for a windows program, and now the computer only wants to boot to Windows.  How do I get back to Mac so I can have a choice of drives?

    That doesn't sound good. It sounds like the power outage might have corrupted the partition for OS X. I would suggest booting from the Install DVD that came with your Mac while holding down the C key. Once you have selected the language start up Disk Utility from the pull down menu and repair the disk. Once you have done that then repair permissions also.
    Allan

  • HT1229 How do you transfer photos to external backup and keep the photos in events with event name or with description name. Each time I have tried to transfer them they only transfer with a jpg number so you don't know what photos are what.

    How do you transfer photos to external backup and keep the photos in events with event name or with description name. Each time I have tried to transfer them they only transfer with a jpg number so you don't know what photos are what. When you have several thousand photos it is difficult to determined what is what.
    Why does iPhoto have the ability to put photos in events and to give them descriptions if it doesn't transfer this info with the photo. I want to back my photos up to an external drive.

    The simplest way to achieve what you want is to back up the iPhoto Library. That will get everything.
    You sem to be exporting from iPhoto to the Finder. The Finder does not have the same organisation capabilities as iPhoto. If you're going to do that you need to understand some of the differences between the two.
    Event Name will become  Folder Name.
    'Description Name' I guess is the Title you give the Photo
    Jpeg Number is the File Name assigned by your camera.
    So: File -> Export
    Set your Kind to Jpeg
    Select your preferred Quality
    Check the Boxes at 'Titles and Descriptions' and Location Information
    Under FIlename select 'Use Title'
    Click on Export. In the Next Window choose a New Folder as your export destination and then Name that as you prefer
    Regards
    TD

  • How  to debug BDC , Dialog program and Script

    Hi all,
    Please let me know, how to  debug BDC , Dialog program and Script
    Thanks&Regards
    Devi

    <b>SCRIPT DEBUGGING</b>
    When we want to debug the SAPSCRIPT, we need to first activate the debugger, we have 2 ways to activate the Debugger.
    1) Execute the program RSTXDBUG
    2) Go to SE71, from the initial screen enter the form name and press Utilities --> Activate Debugger
    When we are in the Debug screen,
    3.1) F5 will be debug filed by field, that means if a single line is having 5 fields, if we press the F5 this will do field by field,
    3.2) F6 will be line by line, that means when we press the F6, it will debug the line and it will go to the next line. F7 also do the same way
    3.3) F8 will be very useful when we have any include statement in the SCRIPT, if any include is there and we press the F5 or F6 then this will go that Include (normally SO10 or any transaction text), then if we want line by line debugging then we can press the F5 or F6, or if you want to execute that in a single shot then press the F8, then the debugger will be executed that include and come back to the Script debugging.
    Some times in the script, we may right lengthy lines, if we want to debug that whole line, we have an option called Left/Right, this we will find the Debug screen of the script, there is a Push button, we can make use this button to debug.
    We can put the breakpoints in the SCRIPT DEBUGGER also, just press the BREAKPOINT Pushbutton from the debugging screen or press EDIT --> Breakpoint
    If we want to debug the print program from the SCRIPT DEBUGGER, just press SHIFT+F7 or EDIT --> ABAP Debugging
    If we want to see the Windows which are defined in the forms, just press the Go to --> Form --> Windows .if we want to see the pages go to --> Form --> pages. Here we have an option to see the page wise window also go to --> Form --> page Windows
    If we want to see the paragraphs which are defined in that script, press go to --> Styles --> paragraphs. 
    If we want to see the Character formats which are defined in that script, press go to --> Styles --> Character Strings. 
    If we want to see the Page formats which are defined in that script, press go to --> OTF --> Page.
    If we want to see the Elements which are used in the Script, then press go to --> Text Elements --> Form Elements.
    If we want to see the commands which are used in the script, press go to --> Commands --> List
    Finally, if we want to exit from the SCRIPT DEBUGING, simply press Debugger --> Exit
    <b>DEBUG BDC</b>
    ust go into debugging mode and do the BDC step by step, when it comes to the Call Transaction line, check the mode which will be 'N'....Now, overwrite this with 'A' and execute the BDC...It will run in All Screens Mode....
    As suggested above the MODE 'A' will do the trick as it takes you to all screens.
    Normally MODE N will be defaulted as it will be used for background processing,
    Here is a simple tip,
    This will be the call transaction part of the program,
    CALL TRANSACTION 'IW32' USING BDCDATA MODE 'N'
    MESSAGES INTO MESSTAB.
    I would suggest you to make it like this,
    DATA: V_MODE TYPE C VALUE 'N'.
    *<In debug mode set V_MODE = 'A' for debugging>
    CALL TRANSACTION 'IW32' USING BDCDATA MODE V_MODE
    MESSAGES INTO MESSTAB.
    This will be very useful because you just need to change the value of the V_MODE at runtime as A for debugging besides it has N which is the default to be used. (i.e. you need not change the code again and again).
    This will be very useful when you have to debug some program in QA or PRD servers.
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • How crm visit the external website and return the value to crm

    how crm visit the external website and return the value to crm?
    Awen

    Can you elaborate the question? I assume that you are looking for some sort of mechanism to validate a customer's web site?
    Regardless of the scenario, the way to validate or retrieve a value from an external web site is to write a plugin that executes a WebRequest to the external site and reads the response.

  • I Logic 9 I bought at appel store installed and want to install the new Logic X, how do I uninstall Logic 9 and have the whole program?

    I Logic 9 I bought at appel store installed and want to install the new Logic X, how do I uninstall Logic 9 and have the whole program?
    Message was edited by: davidjsousa

    Of course

  • How do I turn off programs running in the back ground  for iOS7?

    How do i turn off programs running in the background using iOS 7?

    *iOS 7 closing running apps*
    Double-tapping the Home button will bring up the running apps icons along with an app screenshot "card" above the icon. Tap-drag the app's -card- (NOT the icon) up and off the screen.

  • When I check my boot SSD drive using Disk Utility under Mavericks, I often get "Incorrect number of extended attributes" errors.  But if I boot off an external drive and check the same SSD, no errors are reported.  Is this a bug in Mavericks?

    When I check my boot SSD drive using Disk Utility under Mavericks, I often get "Incorrect number of extended attributes" errors.  But if I boot off an external drive and check the same SSD, no errors are reported. 
    This happens not just with the SSD in my Mac Mini, but with another SSD in my MacBook (both now running Mavericks).  So far as I know, all of the kit I am using is in good order (despite the file corruption reports).  So I am beginning to wonder if it could be due to a bug in Mavericks?  Both SSD drives have been formatted to MacOS Extended (journaled) format.  Should I have used a different format, I wonder?
    Has anyone else encountered this issue?
    Does anyone have a solution?
    Or an explanation that might help my investigation of the issue?
    Thanks guys,

    I understand that the Corsair Force 3 is not one of the SSD drives that are supported on Apple Macs. 
    I did try downloading and using Trim Enabler, but the error message came up both when it was off and when it was on.
    I understand that not everyone thinks Trim Enabler is a good program, though there is a new version out now, so I may give it another try.

  • External Display and Closing the Lid

    I'd like to be able to connect my MB Pro to a external display and close the lid without it going to sleep.
    How do i do it.

    Like this:
    http://support.apple.com/kb/HT3131

  • How to update Tr code FB02   and update the field reference key1 (bseg-xref

    Can any body
    help me how to update   Tr code   fb02
    and  update the field  reference  key1 (bseg-xref1)  with the interest amount
    calculated.
    Below i have  written My  program  flow logic
    The program should read the open items i.e debit items in the customer account,
    Based on the  invoice date and customer payment terms  calculate the due date and then the  interest should be  calculated on that item based on the due date.
    Use the  transaction  fb02  and update the field  reference  key 1 (BSEG-xref1)
    with the interest amount calculated
    Only  consider  customers whose  interest indicator  knb1-vzskz = 'vk'.
    Interest is to be  calculated for every  30  days
    at the rate of  1% .please see example below.
    Document date is 01.01.2007
    for amount  1000SGD   payment  term  7  days
    It becomes  due  on  08.01.2007
    until  06.02.2007 you should not  consider  for calculation of interest
    SGD  on   7.02.2007 run you can consider this  item for interest calculation

    Hi Robert,
    Thanks for answering.
    I am looking at Ref 2 should flow automatically to clearing document from the accounitng document for billing.
    Ex: Billing document is created and accounted. Ref 2 is AB
    Now when receipt is accounted for this biling document this AB should flow automatically to Ref 2 field.
    Thanks
    NNS.

  • Move a file to external disk and remove the original

    This is a script that was supplied to me on these forums it has been working well, but all the transferring of the files took place locally so a 'Move' command does it eactly what it says, however I now need to move it to an external drive, as a result it leaves trace of the original file.
    How can I make it MOVE and remove the origial File please?
    set fileMatrix to {¬
              {folderName:"BHS", prefixes:{"BH70", "SM70", "AL70", "BH11"}}, ¬
              {folderName:"Bu", prefixes:{"BU40", "BU11"}}, ¬
              {folderName:"Ca", prefixes:{"CW"}}, ¬
              {folderName:"Da", prefixes:{"ES20", "AM20"}}, ¬
              {folderName:"Di", prefixes:{"DV25", "DV11"}}, ¬
              {folderName:"Do", prefixes:{"DJ30", "RA30", "DJ11"}}, ¬
              {folderName:"In", prefixes:{"GT55", "CC55"}}, ¬
              {folderName:"Fr", prefixes:{"FR10", "FR11", "FR17"}}, ¬
              {folderName:"No", prefixes:{"TM17", "NN_"}}, ¬
              {folderName:"Ma", prefixes:{"MA65", "MF65", "FI65", "MC65", "MH65", "MB65"}}, ¬
              {folderName:"Pr", prefixes:{"PR_"}}, ¬
              {folderName:"To", prefixes:{"TM15", "TM11"}}, ¬
              {folderName:"Wa", prefixes:{"WA35", "WA11"}}, ¬
              {folderName:"Se", prefixes:{"SE_"}}, ¬
              {folderName:"Mik", prefixes:{""}}}
    tell application "Finder"
      --set theHotFolder to ((path to pictures folder) as text) & "HotFolderDone"
              set theHotFolder to folder "StudioA:Users:StudioA:Pictures:HotFolderDone"
      --set foldericon to ((path to pictures folder) as text) & "Icons:Rejected Folder Done"
              set foldericon to folder "StudioA:Users:StudioA:Pictures:Icons:Rejected Folder Done"
      --set fakeTrash to ((path to home folder) as text) & "FakeTrash"
              set fakeTrash to folder "StudioA:Users:StudioA:FakeTrash"
    set a to alias "Scratches:Workings"
              repeat with matrixItem in fileMatrix -- look for folder
    set destinationFolder to (folders of a whose name starts with folderName of matrixItem)
                        if destinationFolder is not {} then -- found one
                                  set destinationFolder to first item of destinationFolder -- only one destination
                                  set theFolderName to name of destinationFolder
                                  repeat with aPrefix in prefixes of matrixItem -- look for files
                                            repeat with startFile in ((files of theHotFolder whose name starts with aPrefix) as alias list) -- move files
                                                      try
      move startFile to destinationFolder
                                                      on error
      activate
                                                                display dialog "File “" & (name of startFile) & "” already exists in folder “" & theFolderName & "”. Do you want to replace it?" buttons {"Don't replace", "Replace"} default button 2 with icon 1
                                                                if (button returned of the result) is "Replace" then
                                                                          set {fileName, t_ext} to {name, name extension} of startFile
                                                                          if exists file fileName of fakeTrash then -- and it also exists in the fakeTrash Folder.
                                                                                    set name of file fileName of destinationFolder to "this is a unique name" -- or whatever
                                                                                    set newName to my getUniqueName(fileName, t_ext, fakeTrash)
                                                                                    set movedFile to move file "this is a unique name" of destinationFolder to fakeTrash
                                                                                    set name of movedFile to newName
                                                                          else -- not exists in the fakeTrash Folder.
      move file fileName of destinationFolder to fakeTrash
                                                                          end if
      move startFile to destinationFolder
                                                                else -- "Don't replace"
                                                                          if not (exists folder "StudioA:Users:StudioA:Desktop:Rejected Folder Done") then
                                                                                    set theLastFolder to duplicate foldericon to desktop
                                                                          else
                                                                                    set theLastFolder to folder "StudioA:Users:StudioA:Desktop:Rejected Folder Done"
                                                                          end if
                                                                          delay 0.5
      move startFile to theLastFolder with replacing
                                                                end if
                                                      end try
                                            end repeat
                                  end repeat
                        end if
              end repeat
              try
                        if (count theLastFolder) is 0 then delete theLastFolder
              end try
    end tell
    to getUniqueName(theName, theExtension, someFolder)
         check if someFile exists in someFolder, creating a new unique file name (if needed) by adding a suffix
              parameters -          theName, theExtension : a file name and his name extension
                                  someFolder : a folder (finder item or alias)
              returns :     a unique name
              set {counter, suffixes, divider} to {0, "abcdefghijklmnopqrstuvwxyz", "_"}
              if theExtension is not "" then set theExtension to "." & theExtension
              set theName to text 1 thru -((length of theExtension) + 1) of theName -- just the name part
              set newName to theName & theExtension
              tell application "Finder" to set theseNames to name of items of someFolder
              repeat while theseNames contains newName
                        set counter to counter + 1 -- hopefully there aren't more than 26 duplicates (numbers are easier)
                        set newName to theName & divider & (item counter of suffixes) & theExtension
              end repeat
              return newName
    end getUniqueName

    I do not have the time to read through your whole script and give specific answers, but the general principle is fairly easy.  You're moving with the Finder, so your move command is going to be of the form:
    tell application "Finder"
      move file xxxx to folder yyyy
    end tell
    For cross file system moves (which are as you point out actually duplications) just add a line after each move that sends the old file to the trash:
    tell application "Finder"
      move file xxxx to folder yyyy
      delete file xxxx
    end tell
    the Finder has an empty trash command that you can use at the end of the script if you like.
    One gotcha: because move has two different behaviors, the second code block will throw an error if you try to use if for a local move (it will move the file properly, then try to delete the file it moved, which is obviously no longer there).  For clarity, I'd use duplicate rather than move for if you're working across file systems.  That's what you're actually doing, and if you use the move command you may confuse yourself when you come back to look at the script a year down the road.

  • How to launch a function/procedure without suspending the parent process?

    Hi everybody,
    I would like to know if I can define something as follows in PLSQL:
    procedure master
    begin
    call a procedure_child;
    End master;
    I would like that the procedure master does not suspend the execution and wait that the procedure_child finishes in order to resume the executions with the further code.
    Thanks a lot in advanced
    Tomeu

    In the future, please stick to posting in a single forum.
    Re: How to launch a function/procedure without suspending the parent process?

Maybe you are looking for

  • Creation of materialized view

    Hi All, We had created some other materialized view with for small set of data. The materialized view name is 'XXCA_PAGL_RECON_GL1_TRANS_MV' and it has created a table with the same name. What I am unable to understand is that the new table which was

  • File Path for Windows and Linux

    hi can any one give solution how to implement code for odi file copy . i am using Same Code for Windows and Linux OdiFileCopy "-FILE=#Var_Lookup_File_Path \ Employee.csv" "-TOFILE=#Var_Lookup_File_Path_Backup\Employee.csv" "-RECURSE=NO" "-OVERWRITE=Y

  • I am unable to use Highlight Tool in Adobe Reader X. Please suggest me solutions.

    I am unable to use Highlight Tool in Adobe Reader X. Please suggest me solutions.

  • HAVE ONE WEB PAGE OPEN AND SUDDENLY ANOTHER WEB PAGE OPENS

    I can have one web page open and suddenly another web page will pop up. Why? It doesn't happen all the time. Like I said suddenly.

  • Podcast guru

    So I have created a podcast which is now finally posted after the debackle this week with the iTunes store! My question is about keyword search. In the xml file there are about 6 keywords, however when doing a search iTunes only finds the words in th