T
ToSam
In my C++ program I execute a java.class file via the CreateProcess
function. In details:
// define a pointer to directory with Main.class file
char * pExecute = "java Main";
// create a java interpreter process
if( !CreateProcess( NULL, // No module name (use command line).
pExecute, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
CREATE_NEW_CONSOLE,
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
TRACE( "CreateProcess for Execute failed (%d).\n", GetLastError() );
return;
}
The java-class Main.class is the compiled class of the code
public class Main {
public Main() {
}
public static void main(String[] args) {
try{
MCDVersion pMCDVersion = new MCDVersion();
int minor = pMCDVersion.getMinor();
} catch (com.inzoom.comjni.ComJniException e){
System.err.println("Exception: "+e.getMessage());
}
}
}
Obviously, Main.class returns an integer int minor. The big question
is this: How can i pass this integer back to my C++ program to make it
available there? I shall not change the Java code. Any ideas?
function. In details:
// define a pointer to directory with Main.class file
char * pExecute = "java Main";
// create a java interpreter process
if( !CreateProcess( NULL, // No module name (use command line).
pExecute, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
CREATE_NEW_CONSOLE,
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
TRACE( "CreateProcess for Execute failed (%d).\n", GetLastError() );
return;
}
The java-class Main.class is the compiled class of the code
public class Main {
public Main() {
}
public static void main(String[] args) {
try{
MCDVersion pMCDVersion = new MCDVersion();
int minor = pMCDVersion.getMinor();
} catch (com.inzoom.comjni.ComJniException e){
System.err.println("Exception: "+e.getMessage());
}
}
}
Obviously, Main.class returns an integer int minor. The big question
is this: How can i pass this integer back to my C++ program to make it
available there? I shall not change the Java code. Any ideas?