CreateJavaVM not working pls help

Hello folks,
I am trying to get a simple windows console application to lauch the jvm
but the call to JNI_CreateJavaVM keeps failing (returns -1). I have tried
just about everything (with the paths, client dll, server dll,
paths etc.) but nothing seems to work. I have checked the groups did not
find anything that works for me. Please suggest something, even if you don't
see the problem.
I know that the program does find the jvm.dll, because if i reome it from
the path, the programs complains about not finding the dll (i use the one
from the client directory)
Here is the code (it fails on the call to JNI_CreateJavaVM):
(the call to launching the java class is commented out since i was not get
past the problem of creating the jvm)
This is my code
#include <stdio.h>
#include <jni.h>
JNIEnv* create_vm() {
JavaVM* jvm;
JNIEnv* env;
JavaVMInitArgs args;
JavaVMOption options[1];
int i;
/* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purpo
ses of our example. */
args.version = JNI_VERSION_1_4;
// args.version = 0x30010024;
args.nOptions = 1;
options[0].optionString = "-Djava.class.path=c:\\users\\kabilesh\\javacheck\
\jvm";
args.options = options;
args.ignoreUnrecognized = JNI_TRUE;
printf("inside create vm\n");
i = JNI_CreateJavaVM(&jvm, (void **)&env, &args);
perror("error:");
printf("after create vm : %d\n", i);
switch(i) {
case JNI_OK: printf("success");
break;
case JNI_ERR: printf("unknown error");
break;
case JNI_EDETACHED: printf("thread detached from the VM");
break;
case JNI_EVERSION: printf("JNI version error");;
break;
case JNI_ENOMEM: printf("not enough memory");
break;
case JNI_EEXIST: printf("VM already created");
break;
case JNI_EINVAL: printf("invalid arguments");
break;
return env;
void invoke_class(JNIEnv* env) {
jclass helloWorldClass;
jmethodID mainMethod;
jobjectArray applicationArgs;
jstring applicationArg0;
printf("inside invoke class\n");
//helloWorldClass = (*env)->FindClass(env, "example/jni/InvocationHelloWorld
helloWorldClass = (*env)->FindClass(env, "./InvocationHelloWorld");
printf("before main method \n");
mainMethod = (*env)->GetStaticMethodID(env, helloWorldClass, "main", "([Ljav
a/lang/String;)V");
printf("after main method \n");
applicationArgs = (*env)->NewObjectArray(env, 1, (*env)->FindClass(env, "jav
a/lang/String"), NULL);
applicationArg0 = (*env)->NewStringUTF(env, "From-C-program");
(*env)->SetObjectArrayElement(env, applicationArgs, 0, applicationArg0);
(*env)->CallStaticVoidMethod(env, helloWorldClass, mainMethod, applicationAr
gs);
int main(int argc, char **argv) {
JNIEnv* env = create_vm();
printf("inside main\n");
invoke_class( env );
printf("after invoke class");
os- windows xp
C:/users/kabilesh/javacheck/c2javacheck> java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
C:/users/kabilesh/javacheck/c2javacheck>
C:/users/kabilesh/javacheck/c2javacheck> jview
Microsoft (R) Command-line Loader for Java Version 5.00.3810
Copyright (C) Microsoft Corp 1996-2000. All rights reserved.
Usage: JView [options] <classname> [arguments]
Options:
/? displays usage text
/cp <classpath> set class path
/cp:p <path> prepend path to class path
/cp:a <path> append path to class path
/n <namespace> namespace in which to run
/p pauses before terminating if an error occurs
/v verify all classes
/d:<name>=<value> define system property
/a execute AppletViewer
/vst print verbose stack traces (requires debug classes)
/prof[:options] enable profiling (/prof:? for help)
Classname:
.CLASS file to be executed.
Arguments:
command-line arguments to be passed on to the class file
C:/users/kabilesh/javacheck/c2javacheck>
can you please let me know what should i do to make it run.
thanks
kabilesh

Use formatting tags when you post code....
http://forum.java.sun.com/features.jsp#Formatting
And search this forum for examples that work....
http://forum.java.sun.com/forum.jsp?forum=52

Similar Messages

  • I have deployed one application containing youtube video but it is not working pls help

    I have deployed one application containing youtube video but it is not working pls help Application is build using struts2 and is deployed in oracle cloud, login page works fine but the success page is not displayed please help

    Hello,
    A wild guess, given the lack of details:
    I wonder whether it would violate the http://en.wikipedia.org/wiki/Same-origin_policy ?
    This is part of the security infrastructure.
    "Stealing" content to insert it anywhere else might also violate copyrights?
    Technically, does it at least work "on premises" onto WLS 10.3.6?
    Regards
    Patrick.

  • Why my apps are not transferring from PC to iPhone 5? When I connected to PC the icon shows when I select apps it show 'will install' but it never show on iPhone, I re installed iTunes, deleted all apps and downloaded again but its not working pls help.

    Why my apps are not transferring from PC to iPhone 5? When I connected to PC the icon shows when I select apps it show 'will install' but it never show on iPhone, I re installed iTunes, deleted all apps and downloaded again but its not working pls help.

    Next time an app update gets stuck try a reset. Press and hold both the home and power buttons for10-15 seconds till the Apple logo appears. Then release both buttons. Wait till your iPad starts on it's own. Try now. Also YouTube is still available. If you can't find it the the app store go to the bottom of the app store page and tap purchased. All your deleted apps will be listed and you can reinstall YouTube from there.

  • CALL Transaction in background not working pls help URGENT

    hi i have writtin a bdc program which uses CALL TRSANCTION everything is working in foreground.
    if i schedule the program in background the call transaction does not work. any idea why?????????
    pls help its urgent

    hi
    good
    have you checked in the debug mode, if you have checked in the debug mode check wheather it is giving any error before data is displaying in the screen, if any error is displaying as a message than check that error why it is coming there.
    If no error is coming than check your flow of the bdc screen in the debug mode , there must be some prob, so that it is not working in the background.
    thanks
    mrutyun^

  • I have iphone 5 and its rare camera is not working pls help me

    i have iphone 5 warranty expired and its rare camera is not working so pls help me in this case and in service centre also they r not exchanging the phone pls tel me the idea hoe to fix this and start use of rare camers n front camer is working properly.

    We're all in the same boat, more or less. iOS 8.1 was supposed to fix Bluetooth issues (among other things) that appeared with the release of iOS 8.0.1 that iOS 8.0.2 didn't fix, and, well, they're still there...
    A fix is probably on the way, already, but when will Apple release it, no one know...

  • Lenovo G580 the key "{/[" in the keyboard is not working.Pls help.

    Hi,
    I recently bought this laptop less than a month ago.  few day earlier this paranthesis key is not working any more.  Laptop keyboard is without any dust or blemish. I am running ubuntu and when I checked there is no press/release event being registered, using XEV package. I also ran the system with live cd same issue. Tried removing the key and cleaning the interior, nothing helps. 
    Is this a problem with some connection in the keyboard?  I cannot think of any software issues since It was working fine couple days ago? 
    Help would be greatly appreciated since I am in the middle of writing my dessertation.

    Hi
    Welcome To Lenovo Community
    We are really sorry to hear about the issue you are facing,  
    Based on what I read from the post, it seems to be a hardware issue with the keyboard
    Please contact Local Lenovo support to have system verified
    http://support.lenovo.com/en_IN/feedback/detail.page?LegacyDocID=MIGR-76613
    Do give this a try and let us know  
    Hope This Helps
    Cheers!!!
    WW Social Media
    Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    Follow @LenovoForums on Twitter!
    How to send a private message? --> Check out this article.
                            English Community   Deutsche Community   Comunidad en Español

  • Basic invisible button movie clip frame actions not working, pls. help!

    Hi,
    I've got a basic little slide show player which is timeline-based, rolling through 5 images with alpha transitions, and on the topmost layer, I have 5 invisible movie clips which have actions applied to them as follows:
    on (press) {
        gotoAndPlay(21);
    This action should allow for the on click button to navigate to that specific frame, or image, but for some reason it is not working.
    Did I do something wrong? I feel like I've done this before but I'm rusty with Flash since I don't use it all the time.
    Any help is greatly appreciated!
    Thanks,
    Sean

    The invisible movie clip is something I know I've done over the years on many occasions - I'm not sure I'm understanding your alternate technique, can you explain it better? The way my movie clips are invisible is just by setting the alpha to zero in the properties for the movie clip instance (clicking on the object on stage, then setting it in properties)..
    Also, the actions are on the invisible movie clips (buttons) and not the timeline.
    Cheers,Sean

  • I had to uninstall my photoshop elements 9 and now Im trying to reinstall and its not working pls help!

    I had to uninstall my photoshop elements as I deleted a texture and now I am trying to reinstall its just comes up saying that the wizard is saying that it was interrupted and its not installing pls help

    Reneeb41086198 without a specific error I would recommend reviewing Troubleshoot installation | Photoshop Elements, Premiere Elements | Windows which discusses common installation troubleshooting processes.
    You may also want to consider evaluating Photoshop Elements 13 from Picture editor, edit pictures | Adobe Photoshop Elements 13 as it was designed to install and function under Windows 8.1.  Windows 8.1 was not available when Photoshop Elements 9 was released.

  • I have iphone 5. Have no sound and home button is not working pls help., I have iphone 5. Have no sound and home button is not working pls help.

    My iphone 5 has just stopped giving any sound no ringtones, no key clicking or button sounds nothing at all. And the home button has stopped working. Has anyone heard of software 6.1.4 being corrupt Im just updating software at the moment to 7.1. If anyone can offer a pieace of advise would be much appreciated.
    MANY THANKS
    JAY

    The iPhone warranty is not international and as you purchased in
    Malaysia the warranty is only valid in Malaysia
    You could try taking to an iPhone Authorised service provider
    in India but there have been many similar posts to yours
    and I am not aware  of them assisting  with an iPhone from
    outside India

  • Two Oracle databases on one AIX Server - Note working, Pls Help

    Dear Friends,
    I have installed Two SAP systems with Two Oracle Databases on one AIX machine, The Installation of both the systems went fine without any errors, and also i have been able to login to both the systems seperately. (that means i cant start both the systems at a time, its one at a time)
    But the problem is of the Oracle Listener, i am not able to start both the systems with single Oracle Listener processes(tnslistener). I tried all the possible scenarios as mentioned in note 98252 but nothing seems to be of any use so far.
    the thing is i can start either one of the SAP Systems, But my objective is to start both the SAP Systems with one listener processes (LISTENER) and one listener port (1527)
    Or
    you can say i am also ready to keep two different listeners for TWO seperate Oracle databases, I tried doing so as per one of the sap notes in which you have to keep different names of listener and different numbers for listener port for second ORACLE database. I tried doing exactly mentioned in the note but yet unsuccessful...
    Now i am completely lost as what is to be done since its critical i want you to immediately look into it and suggest me the appropriate solution so that i can set up both of my DEVELOPMENT and QUALITY system running...
    To troubleshoot this if you require anything from my side then please feel free to ask me since our functional consultants have to soon start working on the SAP systems.
    Regards
    Ayush

    The note you specified talk about 2 database instances not 2 databases... (I was starting to wonder how you deploy 2 databases), you can have multiple database instances on a DB. The note also give you detailed explanation of the configuration of listener.ora
    Now, if this is the case and you have installed 2 instances (not databases) on the same host and configured the listener according to the note, then you should be able to call R3trans -d from both SID's.. if the R3trans fails please post the contents of trans.log here.
    the thing is i can start either one of the SAP Systems, But my objective is to start both the SAP Systems with one listener processes (LISTENER) and one listener port (1527)
    Then, the configuration of your listener.ora file must be incorrect.
    Regards
    Juan

  • Hi, I have installed some app to my I pad 1, It worked few days, but from tomorrow I can open any apps like calculator, Facebook ect. when touch it only vibrate does not come. pls help me

    Hi, I have installed some app to my I pad 1, It worked few days, but from lastday I can open any apps like calculator, Facebook ect. when touch it only vibrate does not come. pls help me

    It is ok now, I installed new app, then is ok

  • HT4972 i cant update my iphone 3gs to a more newer ios? it says here error! and the phone flashes some connect to itunes.. an if i connct nothing happens.. help me.. the ipgone wont open . and work pls help me thank you!

    i cant update my iphone 3gs to a more newer ios? it says here error! and the phone flashes some connect to itunes.. an if i connct nothing happens.. help me.. the ipgone wont open . and work pls help me thank you!

    Hello AlexCornejo,
    Thanks for using Apple Support Communities.
    The screen you're seeing on your iPhone indicates it is in recovery mode.  Now since the device is not appearing in iTunes on your PC, first follow the steps in this article:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    After following those steps, you should be able to restore your iPhone.
    Take care,
    Alex H.

  • HT4623 I AM FACING PROBLEM AFTER UPDATING (7.0.4) MY PHONE MODEL 5C,AFTER THIS UPDATE SOME TIMES I CANT MAKE CALLS & SOME TIMES WHEN ANY BODY ELSE WANTS TO CALL ME BACK THE MESSAGE COME THAT THE USER IS NOT REACHABLE.PLS HELP

    I AM FACING PROBLEM AFTER UPDATING (7.0.4) MY PHONE MODEL 5C,AFTER THIS UPDATE SOME TIMES I CANT MAKE CALLS & SOME TIMES WHEN ANY BODY ELSE WANTS TO CALL ME BACK THE MESSAGE COME THAT THE USER IS NOT REACHABLE.PLS HELP

    I am facing the same issue! I bought 5c few days back
    and everything was fine till I updated the software 7.0.4!
    Whenever am connected to wifi am unable to make a call and if someone tries
    Calling me they get the message that my number is not
    Reachable! When I go back to 3G the calls work perfectly!!
    Please help me out since I use wifi more than my network.
    Appreciate any advise on this

  • I can't install any app because my install button wont work pls help

    I can't install any app because my install button wont work pls help, what shall I do?

    - What do you mean it does not work? Could it be that the app ere not compatible with your model iPod and its iOS?
    - Try going to Settings>Store and sign out and sign back in.

  • How to fix auto recovery crush? Im in deadline. it was my whole day work, pls help..

    how to fix auto recovery crush? Im in deadline. it was my whole day work, pls help..

    Close ID, find the HIDDEN InDesign Recovery folder (It will be next to InDesign SavedData, and you can find the path to that for your OS at Replace Your Preferences ), and empty it, then restart ID normally, not by double-clicking a file.
    If your file was not damaged during the crash, it should open from the File menu at the last saved state. You will lose anything you did to the file since the last save.

Maybe you are looking for

  • I am missing header and footer in numbers

    after I updated to Numbers 3.01 I miss the footer and header in my docs and can't find any posiibility how to do that. In the older versions there were always header and footer. Can anyone please help? Thanks p

  • Error in Java Runtime Environment when running JNI native library

    Hi, I am kinda new to JNI but understand it [and done some tutorials]. I am trying to implement JavaStyle [ a Java vst host that uses JNI ] and have reached a point where i successfully build the native code to a dll, and almost manage to load the na

  • Editing images in Adobe Reader

    I have set up a form template in Indesign, using form fields, so that customers can edit their contact information and image.  I know that you can edit this information in Acrobat, but is it possible to edit these things in Adobe Reader?  I have open

  • A blinking cursor appears on every web pages.

    It's a blinking cursor that appears on every web pages in different sizes when I click anywhere on the web pages. Look at following pictures please: http://samansh.persiangig.com/2011/cursor4.jpg http://samansh.persiangig.com/2010/cursor.jpg http://s

  • Changing user ID on ipad

    Seems a basic question but just wondering how I switch user ID from mine to my wife's on our iPad so she can sync with her iPhone. We set it up using my apple ID but would make more sense to be hers.