for linux-text, I used to make such an effort:
ProcessBuilder p = new ProcessBuilder("/path/to/file/c/executable");
p.start();
but I had trouble input and output.
This was another suggestion:
Kernel32.java:
public interface Kernel32 extends StdCallLibrary {
----
};
public Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("Kernel32", Kernel32.class, WIN32API_OPTIONS);
----
}
RunTest.java
public class RunTest {
---
static HANDLE inputFile = null;
static void createChildProcess(String cmd){
String szCmdline = cmd;
PROCESS_INFORMATION processInformation = new PROCESS_INFORMATION();
STARTUPINFO startupInfo = new STARTUPINFO();
--
// Create the child process.
if (!Kernel32.INSTANCE.CreateProcess(
--
System.err.println(Kernel32.INSTANCE.GetLastError());
}
else {
com.sun.jna.platform.win32.Kernel32.INSTANCE.WaitForSingleObject(processInformation.hProcess, 0xFFFFFFFF);
---
}
}
static void WriteToPipe()
// Stop when there is no more data.
{
IntByReference dwRead = new IntByReference();
--
for (;;)
{
--
}
That was too long to test as same as jni solution, is there a simpler instruction?