T
tony_lincoln
Dear friends,
I am using JNI to call java from C++, in jdk1.4.1 and Visual C++ 6. It
works well, but without argument transfering:
(I posted this message here, it is not the same as the 3 messages I
posted before. If you read carefully about these 4 messages, you will
find that I am making progress, although slowly. I wish people will not
mind my questions)
Question 1 is about the argument transfering:
In the C++ code, I call the main() of java codes:
jclass string = env->FindClass("java/lang/String");
jobjectArray args = env->NewObjectArray(0,string, NULL);
env->CallStaticVoidMethod(cls, get_main_id, args);
The java code is like this:
String[] fileNamesList =
LM_SearchingFiles.searchGivenFilesInDir(args[0], args[1]);
// if I set args[0] = "E:", and args[1] = "txt", class
LM_SearchingFiles is to search all txt files in disk E.
When I execute the C++ code, there is one error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
I am sure there are sth wrong in one sentence of C++ codes:
env->CallStaticVoidMethod(cls, get_main_id, args);
But where?
+++++++++++++++++++++++++++++++++++Question
2+++++++++++++++++++++++++++++++++++
Question 2 is about GUI made by java:
I made one GUI in Java, and would like to call this Java code from its
main(). In its main() :
public static void main(String[] args)
throws IOException{
frame = new MainFrame(new Menu_3D(), 400, 200);
frame.setLayout(new BorderLayout());
MenuBar bar = new MenuBar();
frame.setMenuBar(bar);
}// end main().
But when I call this java class from C++, the error is :
**************************************************************************************************************************
Sorry, I can't find the class
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# Internal Error (455843455054494F4E530E43505000FF), pid=3888,
tid=3976
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_02-b09 interpreted mode,
sharing)
# An error report file with more information is saved as
hs_err_pid3888.log
***************************************************************************************************************************
When this kind of GUI classes can not work?
I tried as well to call some of my java3D codes, but the java3D classes
still can not be found(the simplest one like HelloUniverse.class). The
error message is like the above. Why?
Thanks. tony
I am using JNI to call java from C++, in jdk1.4.1 and Visual C++ 6. It
works well, but without argument transfering:
(I posted this message here, it is not the same as the 3 messages I
posted before. If you read carefully about these 4 messages, you will
find that I am making progress, although slowly. I wish people will not
mind my questions)
Question 1 is about the argument transfering:
In the C++ code, I call the main() of java codes:
jclass string = env->FindClass("java/lang/String");
jobjectArray args = env->NewObjectArray(0,string, NULL);
env->CallStaticVoidMethod(cls, get_main_id, args);
The java code is like this:
String[] fileNamesList =
LM_SearchingFiles.searchGivenFilesInDir(args[0], args[1]);
// if I set args[0] = "E:", and args[1] = "txt", class
LM_SearchingFiles is to search all txt files in disk E.
When I execute the C++ code, there is one error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
I am sure there are sth wrong in one sentence of C++ codes:
env->CallStaticVoidMethod(cls, get_main_id, args);
But where?
+++++++++++++++++++++++++++++++++++Question
2+++++++++++++++++++++++++++++++++++
Question 2 is about GUI made by java:
I made one GUI in Java, and would like to call this Java code from its
main(). In its main() :
public static void main(String[] args)
throws IOException{
frame = new MainFrame(new Menu_3D(), 400, 200);
frame.setLayout(new BorderLayout());
MenuBar bar = new MenuBar();
frame.setMenuBar(bar);
}// end main().
But when I call this java class from C++, the error is :
**************************************************************************************************************************
Sorry, I can't find the class
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# Internal Error (455843455054494F4E530E43505000FF), pid=3888,
tid=3976
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_02-b09 interpreted mode,
sharing)
# An error report file with more information is saved as
hs_err_pid3888.log
***************************************************************************************************************************
When this kind of GUI classes can not work?
I tried as well to call some of my java3D codes, but the java3D classes
still can not be found(the simplest one like HelloUniverse.class). The
error message is like the above. Why?
Thanks. tony