• 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

URGENT - runtime.exec command doesn't execute on unix

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem i am facing is that if I execute the command ./runpro ( name of my applications executable) from unix command prompt it is working ,also if i write the same command in a shell script it works on executing on the prompt with
sh shellscript.sh
where shellscript contains
./runpro

But if the same shell script is executed through the
Runtime.getRuntime().exec("sh","shellscript.sh") function of java it compiles and when it is run it displays nothing as if nothing has happened .
also directly executing the command through getRuntime().exec(" ./runpro") it is not working.
However if execute getRuntime().exec("ls") it works fine.

Is there any limitation on exec for executing executing users executable or user created .sh.

Pl reply asap

Parag
[ April 07, 2005: Message edited by: parag chandekar ]
 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is your executable, "runpro", a graphical application or a text-mode one? are you running java in a graphical environment, like KDE or Gnome, or are you running it at the text-only console?

if it's a text-mode application and you're not running in text-only mode, you will likely have to provide a terminal for it to run in. try something like:

and see if that works.
 
parag chandekar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The executable, "runpro", is a text-mode application that counts the number of processes running and saves it in a log file .

and I am running java at the text-only console.

I tried your code but it is still not working. Do you have any other solution .Pls help

regards
Parag
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a page that explains how to get scripts to work in a Java app.

Runtime.exec page

This page will walk you through many of the problems people come across using Runtime.exec. It helped me with my problems.
 
What are your superhero powers? Go ahead and try them on 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