problems when using getRuntime().exec()

Hello!

I'd like to start a process which will run a C executable.

The C executable named dbc is placed in the folder

/home/swkm/services/rul_hyb/rul-1.0/bin and accepts as an argument the name of a database, for example, myDB

I tried the following code:

File f =new File(filePath);

Process process = Runtime.getRuntime().exec

(

new String[]

{

"dbc",

"myDB"

}, null,f

);

where filePath is the above mentioned path.

The problem is that I receive an:

java.io.IOException: java.io.IOException: dbc: not found

at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)

I tried the new Tiger version of ProcessBuilder in the following manner:

ProcessBuilder process =new ProcessBuilder

(

new String[]

{

"dbc",

"myDB"

}

);

process.directory(new File(path));

Process p=process.start();

but I got the same exception: "dbc not found"

Do you have any idea what is going wrong?

Thank you very much

With best regards,

Sorin

[1496 byte] By [Sorin_Ciolofana] at [2007-11-27 6:01:51]
# 1
Where is the executable "dbc" ? Are you sure it is in the OS's PATH? Are you able to invoke it through the console from anywhere?If the executable is in the same directory as the Java app, you can try replacing "dbc" by "./dbc"
Dalzhima at 2007-7-12 16:42:21 > top of Java-index,Core,Core APIs...
# 2
Try specifying the current working directory -- you will find there's a version of the exec() method that allows you to do that.
DrClapa at 2007-7-12 16:42:21 > top of Java-index,Core,Core APIs...