launch shell from java

P

pincopallo_it

For my application I need to launch a bash shell in a directory outside
the application server.

Process proc = Runtime.getRuntime().exec("cd
/PINCO/job/Dmrrrfy007/provai && /PINCO/exe/msobfy730 " + serviceDate")
;

What i get is a

IOException = cd: not found

error


Any idea ?
Thanks
Gio
 
G

Gordon Beaton

For my application I need to launch a bash shell in a directory
outside the application server.
[...]

What i get is a

IOException = cd: not found

The error is because cd is not a "program" you can run, it's a shell
builtin. But your command does not include a shell at all, you seem to
be trying to run something else altogether.

If you just want to start an external program in a specific directory,
use a version of Runtime.exec() that lets you specify a directory.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top