rajput g v be comp 56 wrote:

> hi,
>   this is a little off the topic ,but can i run(or call) a C program(i.e
> ./a.out) from a java program on linux ? ( like from c program you can run
> the prompt command by using the command "system" )

It is a matter of executing shell commands in Java, and I believe that there
are no Linux considerations involved.

Runtime.getRuntime.exec( cmd );

where cmd is either a String or String[]. Optionally it also takes
environment settings.
Returned to you is a Process object, which contains methods to interact with
the process that are created.
waitFor()
exitValue()
destroy()
and accessor methods to the stdin, stdout and stderr.

Note; In the current release of the Java2 from Sun, and possibly from
Blackdown, there has been reports that this doesn't work in native threads.
The report says that it will crash everytime, so it should be easy to check.
Use -green option.

Niclas


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to