• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

how to make a Runtime process to finish.?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

i am running make command inside the Runtime.exec() command. but its not fully completed how to achieve this.



how to acheive this one. After the full completely execution of 'make' only it have to print. But its printing and exiting earlier. Any idea.???
 
Greenhorn
Posts: 24
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dharma lingam s wrote:hi all,

i am running make command inside the Runtime.exec() command. but its not fully completed how to achieve this.



how to acheive this one. After the full completely execution of 'make' only it have to print. But its printing and exiting earlier. Any idea.???




Simply add the below line....
p1.destroy();
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You probably have a deadlock due to either the stdout or stderr buffers filling. When this happens the process is suspended until more buffer space is available but since you are not draining either of them the process cannot proceed. This is all explained in the 4 sections of http://www.javaworld.com/jw-12-2000/jw-1229-traps.html. You should ALL of read this and implement ALL the recommendations or you will suffer more grief.

Edit : I'm mystified as to why the OP has not already read the 'traps' article since I posted a reference to it in one of his other threads. I can only assume that he thinks he knows better and that he is immune to the traps. There is no point in me responding any further until I see evidence of the implementation of the 'traps' recommendations.
 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ganesh Gore wrote:

Simply add the below line....
p1.destroy();



I don't think this will solve the OP's problem since it will abort the process without it actually running to completion. The OP almost certainly has a deadlock as I explained in my previous post..
 
dharma lingam s
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
destroy is forcibly terminating that also not working fully. At least any way the runtime(exec) process to run or other process to wait for its completion. atleast some seconds.


 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dharma lingam s wrote:destroy is forcibly terminating that also not working fully. At least any way the runtime(exec) process to run or other process to wait for its completion. atleast some seconds.




Are you determined to ignore my advice ? Why do you bother asking questions here if you just ignore the responses?

Bye
 
dharma lingam s
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, just i asked anyother way to achieve the exec("make") command. so only i did.

i getting exception. process hasn't completed. any way to sole this.
 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dharma lingam s wrote:Sorry, just i asked anyother way to achieve the exec("make") command. so only i did.

i getting exception. process hasn't completed. any way to sole this.



I have told you what to do! Read the sodding 'traps' article and implement the recommendation. That is the only way to do it.
 
dharma lingam s
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Richard Tookey.. its working.
 
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic