This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, i am trying to call a call java application into C code so that it can be run as NT Service. For this I am following the below mentioned way: JNI_GetDefaultJavaVMInitArgs(&vm_args); jint res; /* Append USER_CLASSPATH to the end of default system class path */ sprintf(classpath, "%s%c%s",MY_CLASSPATH, PATH_SEPARATOR, USER_CLASSPATH); vm_args.classpath = classpath; /* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */ vm_args.version = 0x00010001; res = JNI_CreateJavaVM(&jvm,(void**)&env, &vm_args); Here when I run this, I getting a null value for the instance value for the jvm instance value. Could anyone tell me what will cause for the above and what will be the remide for this? Thanks in advance, Satheesh
If all you are doing is trying to call a java application from your C program just try using the system function, nothing fancy, and pass it your a string formated just as it would appear at the command prompt... that is of course if this is what you mean i'm a little confused by what you are asking.
Joined: Aug 20, 2001
Thanks Todd for your reply.. But what I expect is not the one that is included in your reply (sorry if I couldn't explain in detail..) The problem is not calling the application. As It should be run as NT Service, I want to use it's full features so that it could be controlled through the Service Control Manager (SCM). And at the same time I could pass the signals here and there from C++ to java as well. For this I am creating an instance of the JVM so that it could be possible to handle the event through the execution of java classes. In my code, it compiles without any problem, but during runtime, it is not creating an instance to the JVM so that it is crashing. I think I have detailed my problem. Thanks again, Satheesh