• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Install Linux application using Java

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a script(install.sh) which builds a linux application from source it has commands ./configure make and make install..
I want to run that script from java..
I have used Process proc = Runtime.getRuntime().exec("./install.sh"); proc.waitFor();
When i run ./install.sh on shell it continuously gives a large output like processing.. compiling.. etc.. etc.. and the application gets installed
But when i run it using my java prog then the java program waits for a long time and the application does not gets installed..
Is there any solution to the above problem...
Can i run large scripts that take say minutes to complete using java?
Thanks in advance..
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

It sounds as if the Java code isn't handling the streams of the child process. See this article for all the details of what needs to be done.
 
Shivaprasad Nair
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a zillion...
The code is working absolutely fine now...
 
Shivaprasad Nair
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code which i used was as follows: Here i am passing the cmd array to this function

I have made a GUI using swing so on a button click the code gets executed!
I have a textarea i want to dynamically add the contents of the buffer to it i.e. the way the contents gets printed on the console it should get appended in the textarea! I am new to swing...
I tried myTextArea.append(line+"\n"); instead of System.out.println(line); but the content gets added after the execution is complete it does not get added dynamically!
Any help will be appreciated thanks in advance...
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To start with Swing is a proper noun
Secondly please use code tags
Thirdly check out JTextComponent#read().
 
Shivaprasad Nair
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your 1st 2 suggestions i'l keep that in mind.
I tried

but this also appends the entire contents of the buffer when the command gets executed.
I am running a script which takes minutes to run, i wanted the text area to display the contents dynamically so that i can check what is going in the script execution process. I wanted the contents to get printed in the text area the way it gets printed on the console when i use and using read the cursor does not get set at the end so i used setCaretPosition using that it worked! Please help me out...
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shivaprasad Nair wrote:
but this also appends the entire contents of the buffer when the command gets executed.



I am sorry. But wasnt this your requirement?

I have a textarea i want to dynamically add the contents of the buffer to it



I am afraid I am not getting what you are trying to say here. Perhaps you can rephrase it?
PS. Are you aware that you can use JTextArea#append in conjunction with JTextArea#read?
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic