> Welcome evry body,
> i want to ask if there is any way to get the output
> of a native exe (written in c) when we run it from a
> java program using JNI.
Yes. But that has nothing to do with Java nor even JNI.
And it is certainly easier to just use one of the exec() methods.
Thank you for reply,
I launching my exe using the system() function of C,
i am not using Runtime.exe() because i uncontered a lot of problem, you can take a look here:
http://forum.java.sun.com/thread.jspa?threadID=5165759
I want to get the command terminal output of the C program that i run from JNI to display it in a TextArea of my UI.
It seems to be not obvious, i don't found a solution but we are speaking about some thing similar here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4994125
http://groups.google.cl/group/comp.lang.java.programmer/browse_thread/thread/83d3ac071e6fcff8/6c4872d1272e77f3#6c4872d1272e77f3
> Thank you for reply,
>
> I launching my exe using the system() function of C,
> i am not using Runtime.exe() because i uncontered a
> lot of problem, you can take a look here:
>
> http://forum.java.sun.com/thread.jspa?threadID=5165759
>
>
> I want to get the command terminal output of the C
> program that i run from JNI to display it in a
> TextArea of my UI.
>
> It seems to be not obvious, i don't found a solution
> but we are speaking about some thing similar here:
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=
> 4994125
> http://groups.google.cl/group/comp.lang.java.programme
> r/browse_thread/thread/83d3ac071e6fcff8/6c4872d1272e77
> f3#6c4872d1272e77f3
I really doubt your problem is not resolvable. I really do. And I don't see how the bug report applies to you either.
Anyway.
The output of the process will be sent to System.out So you'll have to redirect that somewhere back in. You can do this inside your program.
Your C process is the Java process.
Now I think you are saying you are launching Java-> C -> other exe
If this is the case then you need to direct the other exe out though C to standard out.
This seems quite the mess.
> Thank you for reply,
>
> I launching my exe using the system() function of C,
> i am not using Runtime.exe() because i uncontered a
> lot of problem, you can take a look here:
>
> http://forum.java.sun.com/thread.jspa?threadID=5165759
>
>
Which has nothing to do with java itself.
But regardless, FIRST you must collect the stream output in the C code via some method.
Note doing that is a C problem not a java problem.
So are you doing that? Until you are it is pointless to discuss what needs to be done in java.