Tuesday, July 14, 2009

Can any1 give me standard procedure for calling java method from "c++" using vc++?

basically it invovles invoking JVM....


i tried but got errors !


i tried as follows =%26gt;


created .java ,.class,.h files using javac,javah cmds.


opened vc++ =%26gt; win32 appl'n %26gt; c++ file as source


program is @ sun site JNI specification book ! invocation api's chapter...simple hello world program...


then i set paths of library at file jvm.lib.


set the preprocessor path to jni.h means C:\j2sdk1.4.2_05\include


and run ....


gives many errors linking error like


Linking...


LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16


Debug/ltry.exe : fatal error LNK1120: 1 unresolved externals


Error executing link.exe.


ltry.exe - 2 error(s), 0 warning(s)





sometimes gives error C:\ltry\tr.cpp(18) : warning C4129: 'j' : unrecognized character escape sequence


in code @


options[0].optionString="-Djava.class....





can any1 tell me valid procedure ?


do u hav anyother gud book for invocation api's?


Thanks Amit

Can any1 give me standard procedure for calling java method from "c++" using vc++?
I dont know what the probelm is but it does work when i refer


the docs.





But the procedure will br something like


1. Create a JVM Instance


2. Create an object of the Java Class


3. Call the Method.





The Names will be something like


Java_ClassName_MethodName( Para List );


No comments:

Post a Comment