The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2001


where you can ask and answer Java programming questions."> - a resource for Java and Jini developers
Artima | Search | Java | Design | JVM | Jini | Books | Seminars | Subscribe 

Java Answers Forum
September 2001

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


JNI loading an executable

Posted by bjoern on September 14, 2001 at 4:54 AM

i wrote a c++ prog, that invokes the jvm. than i started a java class.methode which is a native methode. (before i loaded the exe, which invokes the vm into the vm, so the funktion-name-mapping can work)

c++ code
...; jvm->load();...
extern "C"
void Java_ClassName_funktionName(JNIEnv*,jclass)
printf("in the native code");


static native void funktionName();

static void go()


thats all
it works fine if i make the invoking from c++.
if i try to start the methode go() from the java-main() the call
to the native methode works fine, but the printf() is not executed. the java-vm exit with code 128. it dont even throws an exception. and i dont know what's the problem. if i dont printf, but return it also works, i can also call other funktions-methods from the exe, but not anything else.
is it impossible to link an *.exe to the vm? are the other dependent dlls (for printf()) not loaded, who can help


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us