Posted By:
Adolfo_Aladro
Posted On:
Monday, February 18, 2002 11:45 AM
Hi, I'm making a program that invokes the JVM: #include #include #include #define MAIN_CLASS "test" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { JNIEnv* env; JavaVM* jvm; JDK1_1InitArgs vmargs; jint rc; jclass cls; jmethodID mainId; char* szClasspath = getenv("CLASSPATH"); vmargs.version = 0x00010001; JNI_GetDefaultJavaVMInitArgs( &vmargs );
More>>
Hi,
I'm making a program that invokes the JVM:
#include
#include
#include
#define MAIN_CLASS "test"
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
JNIEnv* env;
JavaVM* jvm;
JDK1_1InitArgs vmargs;
jint rc;
jclass cls;
jmethodID mainId;
char* szClasspath = getenv("CLASSPATH");
vmargs.version = 0x00010001;
JNI_GetDefaultJavaVMInitArgs( &vmargs );
vmargs.classpath = szClasspath;
rc = JNI_CreateJavaVM( &jvm, &env, &vmargs );
if( rc
< 0 )
return 1;
cls = (*env)->FindClass( env, MAIN_CLASS );
if( cls == 0 )
return 1;
mainId = (*env)->GetStaticMethodID(env, cls, "main", "([Ljava/lang/String;)V");
if( mainId == 0 )
return 1;
(*env)->CallStaticVoidMethod(env, cls, mainId, 0);
(*jvm)->DestroyJavaVM( jvm );
return 0;
}
I use the following command line:
bcc32 -IC:JDK11~1.8include -IC:JDK11~1.8includewin32 -LC:JDK11~1.8lib -tW test.c
but I always end up getting the same error message:
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external 'JNI_GetDefaultJavaVMInitArgs' referenced from C:TEMPTEST.OBJ
Error: Unresolved external 'JNI_CreateJavaVM' referenced from C:TEMPTEST.OBJ
Which way should I compile this program?
Thanks in advance.
<<Less