• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

runtime.exec()

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am facing a problem in linux.

When i try to excecute a shell script using runtime.exec(),the script not exce cutting properly.The process is not completing.i am using jboss as application server.so the call for shell script is from jboss server.so i think jboss server is the problem here

because When i try to excecute script dirctly from linux,it working correctly .Also i try it using stand alone java class.Its working fine.

please help me to find a solution
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... the script not exce cutting properly.The process is not completing.

Can you please explain exactly what you mean by this? What is happening? Does the script get called at all or not? Do you get an error message? If yes, then what is the error message?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


i am using jboss as application server.so the call for shell script is from jboss server.so i think jboss server is the problem here


Do you mean you are calling Runtime.exec() from an EJB?
 
gireesh sivan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i try to call runtime.exec(),the process will start and is not completing.i can see the process id.when i shutdown my jboss server,the process wiil complete.

eg: i am calling an shell script called uafimail.sh

the process will start i can see the process id of uafimail.sh.

when i shutdown my jboss server the process will complete.

Its only happends when the call is from jboss server.


i can excecute it from a standalone java program,also from linux prompt.

but the problem when its in jboss
 
gireesh sivan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no the call is not from ejb
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The process is not completing.



That sure sounds like the typical problem you get if you do not provide for consuming the error output stream and standard output stream from the Process. Read the JavaDocs for java.lang.Process - where you will find a discussion of the problem.

Bill
 
gireesh sivan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i also provide error output stream and output stream.

But the problem still remaining
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i also provide error output stream and output stream.


How are you reading those streams? Each stream must have a reader in its own thread, you can't just read one and then the other in the same thread.

Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic