T
ToSam
I try to be more specific now: In VC++ I define a OnButtonClick
method. Once the button is clicked, a piece of JAVA-code in a file
must be loaded and compiled using a Java-Compiler (javac). The Java
program returns an integer, say. A Java-example may be this:
public class Main {
public Main() {
}
public static void main(String[] args) {
try{
MCDVersion pMCDVersion = new MCDVersion();
int major = pMCDVersion.getMajor();
} catch (com.inzoom.comjni.ComJniException e){
System.err.println("Exception: "+e.getMessage());
}
}
}
The desired result is in major. After having compiled this code from
C++, it must be executed in order to get the value of major. Then I
would like to pass this integer (that was generated from the Java
code) back to C++, and C++ uses it further. Here is my OnButtonClick
method:
void CTestDlg::OnButtonClick()
{
...
// compile Main.java
system("javac C:\\TEST\\Main.java");
// run Main.class
system("java C:\\TEST\\Main");
...
}
Questions are this: Is this the best way to do it? Secondly, how do
I pass the integer result to C++ so that it can be used again?
Thanks again.
method. Once the button is clicked, a piece of JAVA-code in a file
must be loaded and compiled using a Java-Compiler (javac). The Java
program returns an integer, say. A Java-example may be this:
public class Main {
public Main() {
}
public static void main(String[] args) {
try{
MCDVersion pMCDVersion = new MCDVersion();
int major = pMCDVersion.getMajor();
} catch (com.inzoom.comjni.ComJniException e){
System.err.println("Exception: "+e.getMessage());
}
}
}
The desired result is in major. After having compiled this code from
C++, it must be executed in order to get the value of major. Then I
would like to pass this integer (that was generated from the Java
code) back to C++, and C++ uses it further. Here is my OnButtonClick
method:
void CTestDlg::OnButtonClick()
{
...
// compile Main.java
system("javac C:\\TEST\\Main.java");
// run Main.class
system("java C:\\TEST\\Main");
...
}
Questions are this: Is this the best way to do it? Secondly, how do
I pass the integer result to C++ so that it can be used again?
Thanks again.