Exec() starts new process after my program finishes

Hi all,
I have a problem. I must create a subprocess and connect to it with socket.
My process:
0. String command_to_exec_subprocess="java -cp"+cp+" mypackage.MyMainClass "+args;
1. Runtime.getRuntime().exec(command_to_exec_subprocess);
2. socket.connect(new InetSocketAddress("localhost",25000), 3000);
My subprocess:
1. ServerSocket server=new ServerSocket(25000);
     JFrame jf=new JFrame();
     jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setVisible(true);
2. Socket client=server.accept();
I use: Windows 7
JVM: 1.6
Problem is that frame popsup after my process finished, socket can never connect to server socket. As far as I know this means that Runtime waits with starting subprocess till my main process ends... Does any one know how to make the process execute just after I use exec command?? I tryed to use ProcessBuilder but when I use it it doesnt even start the subprocess... When i run the command from cmd on windows7 it runs with no problem.
Thx.

Read, understand and apply the suggestions in this article: [When Runtime.exec() wont|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html].
When you fully implemented the suggestions in there (careful, it's a multi-page article!), then check if your problem still occurs.

Similar Messages

  • To start the process by external program.

    I'm using Guided Procedure
    I want to start GP Process from external program.
    I've tried Java API and it worked well.
    But, I'm looking for the other way that starts Process of GP (ex, Web Service, URL,,,?)
    Please let me know how to start processes.
    Best regards,
    Koji

    Hi,
    Yes. You can start a process through a web services that can be triggered from a method in a class or FM etc.
    You can refer this link that has a step by step process for the same.
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/44/44c59fd7c72e84e10000000a155369/frameset.htm
    Hope this helps.
    Cheers,
    Mandrake

  • Opmnctl failed-"start managed process after the maximum retry limit"-URGENT

    Hi All,
    I tried to start the opmn process after configuring BIGIP and securing the OMS.But opmnctl startall failed saying unable to start "HTTP_Server".
    [aime@stamt02 ~/TC3]$ ./oms10g/opmn/bin/opmnctl startall
    opmnctl: starting opmn and all managed processes...
    ================================================================================
    opmn id=stamt02:6200
    5 of 6 processes started.
    ias-instance id=EnterpriseManager0.stamt02.us.oracle.com
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ias-component/process-type/process-set:
    HTTP_Server/HTTP_Server/HTTP_Server
    Error
    --> Process (pid=30117)
    failed to start a managed process after the maximum retry limit
    Log:
    /scratch/aime/TC3/oms10g/opmn/logs/HTTP_Server~1
    log file says :
    [aime@stamt02 conf]$ tail -f /scratch/aime/TC3/oms10g/opmn/logs/HTTP_Server~1
    07/04/24 04:29:24 Start process
    /scratch/aime/TC3/oms10g/Apache/Apache/bin/apachectl startssl: execing httpd
    07/04/24 04:29:29 Start process
    /scratch/aime/TC3/oms10g/Apache/Apache/bin/apachectl startssl: execing httpd

    Same problem for me also.
    I could start all other process except HTTP
    while starting that it is show a mesg as follows
    ------------------------------------------------+---------
    ias-component | process-type | pid | status
    ------------------------------------------------+---------
    DSA | DSA | N/A | Down
    HTTP_Server | HTTP_Server | N/A | Down
    LogLoader | logloaderd | N/A | Down
    dcm-daemon | dcm-daemon | N/A | Down
    OC4J | home | 3596 | Alive
    [oracle@mrk bin]$ ./opmnctl startall
    opmnctl: starting opmn and all managed processes...
    ================================================================================
    opmn id=mrk.mydomain.com:6200
    0 of 1 processes started.
    ias-instance id=ias_hns.mrk.mydomain.com
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ias-component/process-type/process-set:
    HTTP_Server/HTTP_Server/HTTP_Server
    Error
    --> Process (pid=3860)
    failed to start a managed process after the maximum retry limit
    Log:
    /u01/Oracle10gAS/opmn/logs/HTTP_Server~1
    Please any one help me.
    mail me at [email protected]
    Thanks in advance

  • Error in starting new process in GP

    Hi All
    I am facing a problem is starting a new GP process dynamically.
    On the following step I get a GP InvocationException
    IGPUserContext userContext =GPContextFactory.getContextManager()
                             .createUserContext(processUser);.
    Message:
    ERROR_ALREADY_STOPPED
    com.sap.caf.eu.gp.base.exception.InvocationException: ERROR_ALREADY_STOPPED
    at com.sap.caf.eu.gp.base.caching.MemoryCache.checkActive(MemoryCache.java:231)
    at com.sap.caf.eu.gp.base.caching.MemoryCache.getEntry(MemoryCache.java:282)
    at com.sap.caf.eu.gp.model.context.impl.UserContextFactory.getUserContext(UserContextFactory.java:195)
    at com.sap.caf.eu.gp.model.context.impl.UserContextFactory.getUserContext(UserContextFactory.java:181)
    at com.sap.caf.eu.gp.context.impl.GPUserContext.<init>(GPUserContext.java:85)
    I tried to restart the Server, even that does not help.
    Please help
    Deepu

    hi deepu
    check this
    http://help.sap.com/saphelp_nw04s/helpdata/en/44/7a056cdb0b6573e10000000a11466f/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/fcdf77fc6510b3e10000000a11466f/frameset.htm
    Can't start GP process by GP API
    let me know u need any further info
    bvr

  • Accidentally pushed "start new session" after crash. Tabs are gone from history.

    After one of the ten crashes per day since I upgraded, I accidentally pushed, "Start New Session" instead of "restore". So, my '''closed window/tab records were wiped out''', and in my history, it only has those tabs that I opened anew this morning - NOT the ones I had saved so I could look at them later. A lot of these I had not bookmarked yet.

    If you haven't closed Firefox then see if you still can restore that session via Firefox > History > Restore Previous Session.
    You should update the Flash and Java plugin to the latest versions
    * http://www.mozilla.com/plugincheck/
    See also:
    * http://kb.mozillazine.org/Firefox_crashes
    * [[Firefox crashes]]

  • When I try to back up my iCloud device it will start the process but will not finish the backup

    When trying to backup my iCloud on iPad it will start the process but moments later it stops and is unable to finish

    This may be caused by a corrupt existing backup that needs to be deleted, or by data on your device that is causing the backup to fail.  To troubleshoot these, try deleting your last iCloud backup (if you have one) by turning off iCloud Backup in Settings>iCloud>Storage & Backup, then tap Manage Storage, swipe across your backup and tap Delete, then go back and turn iCloud Backup back on and try backing up again.
    If it still won't back up, you may have an app or something in your camera roll that is causing the backup to fail.  To locate which one, go to Settings>iCloud>Storage & Backup>Manage Storage, tap the name of your device under Backups, under Backup Options tap Show All Apps, then turn them all to Off (including camera roll) and try backing up again.  If the backup is successful, then the camera roll and/or one of your apps is causing the backup to fail and you'll have to located by process of elimination. Turn the camera roll On and try backing up again.  If it succeeds, turn some of your apps to On and try backing up again.  If it succeeds again, turn some more apps to On then try again; repeat this process until it fails.  Eventually you'll be able to locate the problem app and exclude it from your backup.

  • How do I open a new url after a flv finishes playing?

    Sorry for asking this question again, but I'm under the gun.
    I have a get
    url action script command in my movie in the frame after an
    FLV. It doesn't
    work. What's the trick to triggering a getURL command when an
    FLV finishes?
    Thanks.

    Fudo wrote:
    > Sorry for asking this question again, but I'm under the
    gun. I have a get
    > url action script command in my movie in the frame after
    an FLV. It doesn't
    > work. What's the trick to triggering a getURL command
    when an FLV finishes?
    >
    help - search - cue points
    Regards
    Urami
    Happy New Year guys - all the best there is in the 2006
    <urami>
    http://www.Flashfugitive.com
    </urami>
    <web junk free>
    http://www.firefox.com
    </web junk free>

  • Starting New process (continous) from another java process

    Hi,
    I am running into a trouble in starting a new java process (continous process it is like daemon process ) from another java process.
    Eg;
    Caller.java runs on one JVM instance, from this Caller.java i need to start a daemon java process ConnectionManager.java (My caller.java should have to know whether ConnectionManager was successfully started as a seperate java process or not)
    Also Caller.java has to stop ConnectionManager.java(which is running as seperate process)
    Any help would be appeciated.
    Thank you very much.

    First of all the design is unusual. Your issue is basically intercommunication between two processes written in java. There are various ways to do that:
    1. Use Persistent system(File/Database) : Easiest but have external dependency.
    2. Use RPC calls both JVM,s little bit complex.
    3. Run new JVM in debug mode and connect on bootstrap port.
    4. Communicate using Sockets.
    Whatever suits you...

  • Auto-start OC4J process after Linux reboot

    Oracle 11gR2, OC4J 10g (10.1.3.5.0), RHEL5 64 bit
    Hi All,
    I am trying to figure out how to get my oc4j process start at boot time. I already have a dbora script setup. I tried adding the following line to my dbora/dbstart script but it did not do anything:
    #!/bin/sh
    # chkconfig: 345 99 10
    description: Oracle auto start-stop script.
    ORACLE_OC4J_HOME=/u02/oc4j
    JAVA_HOME=/usr/java/jdk1.6.0_21/
    su - $ORACLE_OWNER -c "$ORACLE_OC4J_HOME/bin/oc4j -start"
    I read somewhere that I may need to put the entire path like:
    /usr/bin/java -jar /path/to/oc4j.jar &
    Just not sure where and how to put that path in the file.
    Thanks for your help all.
    JrOraDBA

    Hi,
    To run oc4j in the background, on Linux
    Execute the following command:
    nohup ./oc4j -start &
    to run oc4j in the background. The 'nohup' command ignores the hangup signal (closing the terminal window) and enables oc4j to continue running in the background.
    In rare cases, oc4j will not shutdown cleanly with the standard command:
    ./oc4j -shutdown -port 23791 -oc4jadmin <admin_pwd>
    In those cases, try the following command:
    java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin <admin_pwd> -shutdown
    to stop the oc4j service.
    Thanks,
    Sharmela

  • TM - starts new backup after disconnect

    I am using a 250GB external FW drive to backup my 320GM internal. Since the internal drive only has about 150GB on it, it seems to start out fine and TM funtions normally. This may or may not be related to my actual issue...
    If the power is ever cycled to the ext drive, or it is disconnected/remounted or my mac reboots, TM does not seem to recognize the existing set of backups and tries to start a whole new backup. This leads to an insufficient space error and TM stops backing up. I thought TM was supposed to recognize the existing backups and do an incremental backup as if it had never been disconnected (the way it is supposed to work for laptops).
    Any solutions?

    Disconnecting is unlikely to be the problem. This might be:
    http://docs.info.apple.com/article.html?artnum=306928
    The 10.5.2 update is supposed to have fixed a few of these problems so might be worth trying. (Also check that the mac actually has a computer name in the sharing preference pane).

  • How to start the process.

    I'm using CE 7.3 for BPM.
    I would like to start process from simple menu not using Process Repository.
    Does anyone know hot to start BPM process form menu ?
    Do I have to develop webDynro applicatin that calls web-services for staring the process ?
    Best regards,
    Koji Nagai

    Thank you for your reply.
    I understand how to start BPM process by using BPM API.
    But in my project, we need to minimize the developed objects.
    To use BPM API means to develope programs right ?
    If possible, I would to start BPM process without developing programs.
    Is there any way to start BPM process from menu without add-on programs.
    Best regards,
    Koji Nagai

  • Exit Excel process after finish loading

    Hi ,
    my problem is how to exit the excel process after i import the excel file in forms 10g
    , the file closed successfuly but the process still in memory
    how can i kill this process after finish importing the excel file .

    Why are you programmatically opening an Excel sheet in C# instead of using the DataFlow task with an Excel input?
    Since your task is programmatically starting Excel via "new Microsoft.Office.Interop.Excel.Application();", it is your responsibility to stop it.
    Please see "Quit":
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application.quit(v=office.15).aspx

  • SP3 Almost completes installation but freezes at the Finishing stage showing "Running processes after install"

    I have an HP Pavilion zd7000 laptop with Windows XP & SP2 update installed. Processor is Intel Pentium 4. My system is clean with no rubbish software running. I have several anti-malware & anti-spyware systems installed but they are dormant & not running during the attempted installation. SP3 almost completes installation but freezes at "Finishing" stage showing "Running processes after install". Anti-virus is of course switched off. The system then hangs fore-ever with hard disc activity showing intermittently but nothing else happening. Luckily, by holding down the laptop on/off switch I can always eventually restore to previous settings & recover full use but without SP3! This is annoying & frustrating. I have seen a lot of threads about this problem but no real answers. Can anyone help please?

    What is Shmrate.exe is not running?
     This can be read two different ways
    One well if you look at it like this
    User>shmgrate>Operating system>drivers>computer. Result is denied!
    If you have something like this
    User > User Account Control >Operating system>drivers>computer. Result is denied again!
    Note that an adminstrator is only a adminstrator and Computer Adminstrator can install Sp(s). Which I believe is tyour question. Which is my guess.
    Which is the reason some people reccommend installing from the "Adminstrator" account Which generally is not a User account. Yes some people add and modify there account access by using Subinacl.exe and reset.cmd, which bumps the account from adminstrator to Computer Adminstrator. An alternative is to boot into safe mode. Pressing the *F8* key before the windows welcome screen starts up. And selecting safe mode. Which is why more people report success with using the .ISO install.
      To add to your confusion. Windows Sp2 usually has windows installer 3.0, or windows installer 3.1
    Table us types of accounts. I wish windows 200 documentation had made it completely into Xps documentation. They had an excellent table with tthe types of accounts
    Limited user. Not able to run more then basic programs. Not able to ;install device drivers, not able to install progras, not able to install Sp(s)s
    Power user Able to run more advanced programs. IE Defragger.
    adminstrator. Mess with the operating system, back up things, able to install programs, add users.When Windows Xp is installed this is the type of user associated with adminstrator. NOT CA
    Computer adminstrator. Able to Install of all things Sp(s).
    Hopefully this helps you out. Of course there is the release notes, Xp solution center and of course things to do before installing Sp3.
    Keith

  • Blank Screen with cursor after login Windows 7, Unable to start new tasks

    My problem is similar to the well know Windows 7 Black Screen as referenced by Prevx, though different. When I boot my Windows 7 computer, the login screen appears as always. Following entering the password for default user,
    the screen will give the impression of login, but the final result is a plain black screen with the cursor only. The black screen appears indefinitely and the Windows GUI never appears. The only available option from booting in normal mode with this is Ctrl-Alt-Del
    (Task Manager). From analyzing another computer with Windows 7 Professional, my Task Manager is missing the following user processes: dwm.exe, explorer.exe, and taskhost.exe. Additionally, it is missing the following system processes (possibly irrelevant):
    spoolsv.exe and wmiprvse.exe.
    When I attempt to start a new process using Windows Task Manager, an error message will appear saying “Windows Task Manager has stopped working” and forces you to close Windows Task Manager. This includes starting
    any process such as cmd or explorer.
    I attempted to boot into safe mode. 
    The result was the same as above. Then I attempted booting into safe mode with command prompt. This showed some hope. Following authentification from the login screen, the command prompt appears with the same blank screen with a cursor behind it. Initially
    I attempted to run msconfig.msc to run a clean startup. System Configuration Utilities opens briefly then displays the error same as above. “System Configuration Utility has stopped working” and again forces the program to close. Then I tried to
    open regedit. This works with no error messages! So I have access to the registry, but have no idea what I should modify to get my computer running normally.
    Things I have tried:
    1)   
    Restoring to last know good configuration. (No result)
    2)   
    Repairing Windows configuration. (No result)
    3)   
    Scanning the drive 3 separate times for viruses with both Avast and Symantec. (No viruses detected)
    4)   
    Repairing the REG_SZ value HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell as proposed in
    http://social.technet.microsoft.com/Forums/en/w7itprogeneral/thread/5b94b775-992e-4f48-b3ff-c89b3cf45e82
    5)   
    Executing Prevx’s fix file as proposed in
    http://www.prevx.com/blog/140/Black-Screen-woes-could-affect-millions-on-Windows--Vista-and-XP.html
    Any ideas are much appreciated.
    Thanks,
    John

    Same problem  I've found a solution.
    #1 Hit fastly 5 time the left shitf button on your keyboard.
    A windows will appaers to know if you want to caps lock. Keep it open
    #2 Alt-CTRL-Del
      You have know your desktop
    #3 Go on add-remove programme
    3a) Go on windows add-remove
    3b) Remove internet explorer
    ok-ok-ok - untill it's remove and ask to restart
    #4 No more problem. You have to go on the net with chrome or firefox.

  • HT203177 I had to get a new hard drive in my 27 in IMac. I used time machine to get everything back on my computer. I just turn on time machine and its says it's preparing over 800,000 items to back-up, it never back-up, it stop and starts the process ove

    I had to get a new hard drive in my 27 in IMac. I used time machine to get everything back on my computer. I just turn on time machine and its says it's preparing over 800,000 items to back-up, it never back-up, it stop and starts the process over again.

    Could be many things, we should start with this...
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
    *Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then repair the backup/TM drive.

Maybe you are looking for