Can't load jvm.dll in Vista

I have a bizarre problem with JDK1.6.0_03 and Windows Vista. I am trying to compile and run a C program that calls a Java method, using the invocation API. In the past, this worked like a charm, provided I had c:\Program Files\Java\jdk1.6.0_03\jre\bin\client on the PATH.
It no longer works. I get an error message that jvm.dll was not found and that Windows will notify me if it finds a solution to my problem. (I am not holding my breath.)
I then try to load the library manually:
   HINSTANCE h = LoadLibrary("c:\\Program Files\\Java\\jdk1.6.0_03\\jre\\bin\\client\\jvm.dll");
   if (h == NULL)
       printf("Can't load library\n");
       exit(1);
     }I get the exact same error message.
Did something break in Vista, or do I need to look elsewhere for a stupid configuration error?
Thanks,
Cay Horstmann

Just in case some other poor soul gets to this, here is the way to implement the invocation under Windows Vista:
#include <jni.h>
#include <stdlib.h>
#include <windows.h>
typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **, JNIEnv **, JavaVMInitArgs *);
int main()
   JavaVMOption options[2];
   JavaVMInitArgs vm_args;
   JavaVM *jvm;
   JNIEnv *env;
   long status;
   jclass class_Welcome;
   jclass class_String;
   jobjectArray args;
   jmethodID id_main;
   HINSTANCE h1, h2;
   CreateJavaVM_t createJavaVM;
   h1 = LoadLibrary("c:\\Program Files\\Java\\jdk1.6.0_03\\jre\\bin\\msvcr71.dll");
   if (h1 == NULL)
      printf("Can't load library msvcr71.dll\n");
      exit(1);
   h2 = LoadLibrary("c:\\Program Files\\Java\\jdk1.6.0_03\\jre\\bin\\client\\jvm.dll");
   if (h2 == NULL)
      printf("Can't load library jvm.dll\n");
      exit(1);
   options[0].optionString = "-Djava.class.path=.";
   memset(&vm_args, 0, sizeof(vm_args));
   vm_args.version = JNI_VERSION_1_2;
   vm_args.nOptions = 1;
   vm_args.options = options;
   createJavaVM = (CreateJavaVM_t) GetProcAddress(h2, "JNI_CreateJavaVM");
   status = (*createJavaVM)(&jvm, &env, &vm_args);
   if (status == JNI_ERR)
      printf("Error creating VM\n");
      return 1;
   class_Welcome = (*env)->FindClass(env, "Welcome");
   id_main = (*env)->GetStaticMethodID(env, class_Welcome, "main", "([Ljava/lang/String;)V");
   class_String = (*env)->FindClass(env, "java/lang/String");
   args = (*env)->NewObjectArray(env, 0, class_String, NULL);
   (*env)->CallStaticVoidMethod(env, class_Welcome, id_main, args);
   (*jvm)->DestroyJavaVM(jvm);
   return 0;
}Compile with
gcc -g -mno-cygwin -D __int64="long long" -I /cygdrive/c/Program\ Files/Java/jdk1.6.0_03/include/ -I /cygdrive/c/Program\ Files/Java/jdk1.6.0_03/include/win32/ -o InvocationTest InvocationTest.c Of course, in a real application, you'll want to dynamically locate the Java directory; look at launcher/java_md.c inside src.zip for inspiration.

Similar Messages

  • Can't load jvm.dll

    the following simple code can't load jvm.dll
    at windows xp sp2 ,
    jre-1_5_0_11
    #include <jni.h>
    #include <stdio.h>
    int main() {
         HINSTANCE hVM;
    if((hVM = LoadLibray("C:\\Program Files\\Java\\jre1.5.0_11\\bin\clien\\jvm.dll"))==NULL){
    printf("faild\n");
    else
    printf("succes\n");
         return 0;
    }

    #include <iostream>
    #include <stdlib.h>
    #include <windows.h>
    using namespace std;
    int main(int argc, char *argv[])
    HINSTANCE hVM;
    char *path="C:\\Program Files\\Java\\jre1.5.0_11\\bin\client\\jvm.dll";
    if((hVM = LoadLibrary(path))==NULL){
    printf("Error : %d\n",GetLastError());
    else{
    printf("succes\n");
    FreeLibrary(hVM);
    return 0;
    }

  • Win2000 & 1.4.0 Beta2: Could not load jvm.dll

    Question: How does 1.4 Beta2 find it's resources?
    When trying to run Install Anywhere 4.5, I get the error message:
    Can't launch executable.
    Could not load jvm.dll
    Try re-installing the Java VM and change the java VM used by the application
    The call is
    D:\Compiere2\jre\bin\java.exe -Xms16777216 -Xmx50331648 -noverify com.zerog.lax.LAX C:\\Temp\\I1003700413\\Windows\\CUpdate.lax C:\\Temp\\env.prop
    OK, I have about 4 different SDKs installed and I heard that if you deinstall everything else and just install 1.4 Beta 2 - it supposetly works. This is not an option, if you try to install/upgrade an application where the user does not know that a VM is.
    The environment:
    JAVA_HOME is set to a 1.4.0 Beta 2 JRE and the PATH is also pointing to the \bin directory ... and in their server/client sub-directories is the jvm.dll
    I guess, that some registry entry is used ... but where do I find that?

    You're running Java2 from "D:\Compiere2\jre". Does the file "D:\Compiere2\jre\bin\hotspot\jvm.dll" exist? And is this the installation which is Java 1.4?
    As far as where the registry entry is kept, it is in HKEY_LOCAL_MACHINE/Software/JavaSoft. However, this value only seems to be used when you run the java.exe which Sun install in the Windows system directory.

  • IDE Cannot load jvm.dll - what fixes this?

    Hi,
    I have Sun One Community Edition installed.
    I then installed Java web start again and now when I try and run Sun One Community Edition it return the following error:
    IDE
    Cannot load jvm.dll
    Any suggestions as to where I can find information on this or what the fix is.
    Why cant sun package 1 product, rather than having to install Sun ONE App Server, then find it dosnt work, then install J2EE to fix that, now find Sun One does not work...

    Maybe an incompatible jvm.dll is now in the PATH? I've never used Sun One but it's one possibility...

  • "Cannot load jvm.dll" please help solve

    Hello
    I downloaded and installed the following onto windows 98 SE :
    JavaSE installed @ C:\Program Files\Java\j2re1.4.2
    Java2 SDK installed @ C:\Program Files\j2sdk_nb
    NetBeans installed @ C:\Program Files\j2sdk_nb\netbeans3.5
    When I start NetBeans using the desktop shortcut, I get IDE Alert "Cannot Load jvm.dll"
    Can anyone explain to me what I have done wrong and what I have to do in order to put it right.
    I found some stuff about editing 'paths to jvm.dll' but I have found 5 jvm.dll files... which one do I use?
    C:\Program Files\j2sdk_nb\_jvm\jvm.dll
    C:\Program Files\j2sdk_nb\_jvm\bin\classic\jvm.dll
    C:\Program Files\j2sdk_nb\_jvm\bin\hotspot\jvm.dll
    C:\Program Files\j2sdk_nb\_jvm\bin\server\jvm.dll
    C:\Program Files\Java\j2re1.4.2\bin\client\jvm.dll
    Can anyone help me get started getting started with Java?
    Thank you

    Hi
    I have just been suffering with the same problem and managed to find a solution based on answers in these very forums
    What worked for me was to add an entry into the ide.cfg file which told netbeans which folder my JDK was installed in.
    All you need to do is add the following line into the config file (which is in the bin folder under wherever you installed NetBeans 3.5) and it should start up (obviously you will need to change the folder name to match wherever you have your Java development kit)
    -jdkhome d:\JDK1.3
    Hope this works as well for you as it did for me
    Phil

  • Cannot load jvm.dll

    I have installed j2sdk 1.4.2, on windows ME. it seems to have installed ok, but when i try to run it, i just get a message saying "cannot load jvm.dll" Any suggestions?

    I have installed j2sdk 1.4.2, on windows ME. it seems
    to have installed ok, but when i try to run it, i just
    get a message saying "cannot load jvm.dll" Any
    suggestions?Are you using NetBeans?
    If yes, look here:
    http://forum.java.sun.com/thread.jsp?forum=14&thread=434036

  • Help!my application can not load oci.dll

    i have a server with windows 2003 enterprise sp2, oracle 10g was installed on it.now i want to run a .net application,but it's not working,cause oci.dll can not be loaded. then i installed PL/SQL and instant client 11g. but still not working. the error is :"initialization is error, can not load oci.dll.....returned 0". also,i wroted a small application to load oci with win32 api(LoadLibrary) and returned 0 too.
    I'm sure there are no 32bit,64bit things. from os to application,32bit was checked. and i changed server but same os ,same oracle, after application and instant client installed,same problems got. so i'm think about is there any conflicts when oracle 10g and odac/instant client work together

    If you have Oracle 10 installed on a Windows computer, you have oci.dll.
    If "oci.dll can not be loaded", the problem is not a lack of oci.dll.
    The first thing you should do is uninstall Instant Client and anything else you installed to fix the problem (I don't know what you mean with "install PL/SQL").
    Then check if oci.dll can be loaded, e.g. by starting sqlplus and connecting to a database.
    If that works, oci.dll is fine.
    If your program cannot load oci.dll, something in your setup has a problem.
    Maybe it cannot find oci.dll and you have to tell it where to look.
    Yours,
    Laurenz Albe

  • JDEVELOPER CAN'T LOAD JVM

    I try to Install Jdeveloper 3.1 in a directory different from the default directory. It give me an error " I can't
    load JVM" when I try to use Jdeveloper.
    If I try to install in default directory every thing goes well.
    anyone could help me?
    Bye

    I get this message when I start Jdev.
    I install Jdev in a win95 (release 4.00.9500b ) PC with 80M RAM.
    at first I try to install Jdev (full option) in a different directory from default because my c drive was full. I get the error.
    then I free some space on drive c, I disinstall Jdev and reinstall with mimimal space requirement (compact option) on default directory and every thing goes well.
    The same thing happen with Jdev 3.0.
    Anyway, maybe I have understand what happens; with a full
    drive c swap file could not grow and so i get the error. When I free space every thing
    goes well not because of the different directory but because of free space.

  • Can not load sqresus.dll

    Hi,
    after a new ODBC-driver installation I tryed to add a file-DSN but the result is an error:
    "Can not load sqresus.dll".
    This file is located in the same directory as 'sqora32.dll' and 'sqoras32.dll'.
    Has anybody an idea.

    it was the wrong mfc42.dll version

  • Error loading jvm.dll

    our company has an application that we use for company business that runs off Java.  Lately, I have several users that can no longer launch the application.   All are receiving the same error "The Java Runtime Environment cannot be loaded from <C:\PROGR~2\Oracle\JINITI~1.18\ bin\hotspot\jvm.dll>   We are running IE 10, Window 7 and latest version of Java. I did however try to use an older version of Java to no avail.  Any assistance will be greatly appreciated.

    jvm.dll should be in the <java>\bin\classic directory.
    If it's not, then I THINK there's something wrong with your java runtime environment (jre).
    Is this something you installed yourself - the java - or was it soemthing dropped on yoour system by the Oracle product?
    o former: Get a new jre.
    o Latter: Get a new jre and/or complain to Oracle.

  • How to load jvm.dll (in C++) ?

    Hi friends,
    I've started using JVM for one of my software. I've understood how it works.
    But now i want to create my own application which can take any .class or .jar file and then start executing the same through my program (C++).
    I don't know from where to start. Can anybody help me? (May be with some sample code of C++ for the same?)
    Thanks in advance

    Thanks for responding my query,
    But i'm aware of how to load any dll in C++, but i want to know which functions are avaible with jvm.dll and help on those functions.
    For example JNIenv or some thing is used in C++ which is related to java environment. So what do that mean?
    If i want to know how many classes exist in given jar file then which method out of jvm.dll should i go for?
    If some I get some program, that will be beneficial.
    Thanks again.

  • Failed to load JVM.dll

    Hi
    I am trying to upload report templates in 8.1.1.3, but getting below error.
    SBL-EAI-05006: Failed to load the JVM Dll. Check that the specified dll name is correct.
    Object manager error: ([0] Failed to load the JVM Dll. Check that the specified dll name is correct.(SBL-EAI-05006) (0x23138e))
    SBL-OMS-00107: Object manager error: ([0] Failed to load the JVM Dll. Check that the specified dll name is correct.(SBL-EAI-05006) (0x23138e)).
    And I tried to set JVM DLL Name in profile configuration for XMLPSubSys component, and tried with all JVM dll file location paths in our server enviornment.
    also tried to find C:\PROGRA~1\Java\JDK15~1.0_0\jre\bin\server\jvm.dll unfortunately i didn't find this path.
    Can any one share the solution how can I create or set the correct path for above error?
    Thanks
    Sean

    Hi Sean,
    if you cannot find the path C:\PROGRA~1\Java\JDK15~1.0_0\jre\bin\server\jvm.dll manually, then it's clear that Siebel can also not find it.
    Make sure you have a supported JRE or JDK installed on your machine or on the Siebel server, and that the path is correct.
    In case of Siebel Web Client:
    * Java needs to be installed on the Siebel server
    * The DLL property of the named subsystem you mentioned must point directly to the jvm.dll file (e.g. C:\Program Files\Java\jre6\bin\client\jvm.dll)
    In case of Siebel Mobile/Developer Client:
    * Java needs to be installed on the client
    * The DLL property in the subsystem defined in the client's CFG file (e.g. siebel.cfg) must point directly to the jvm.dll file (e.g. C:\Program Files\Java\jre6\bin\client\jvm.dll)
    Benny

  • Error loading jvm.dll - urgent!!

    Hi,
    When I try to compile using javac, I get an error as stated below:
    Error loading: y:\sys\nt\j2sdk-1_3_1\jre\bin\hotspot\jvm.dll
    What am I missing?
    Thanks

    check if jvm.dll exists in y:\sys\nt\j2sdk-1_3_1\jre\bin\hotspot. May not be a good solution but try to uninstall and re-install j2sdk. Also check ur CLASSPATH settings
    Vinay

  • Can't load jvm on W7x64

    Not sure if this is the best forum, but I'm hoping that someone here has run into this same problem...
    My Win32/MFC application uses some java code via the JNI interface. I look in the Registry to find the jre path (RuntimeLib) and then I use ::LoadLibrary to load the jvm. On XP and W7x32 this works. However, on W7x64, even though I correctly find the path to the jvm, LoadLibrary fails with err=126, cannot find component. I assume this has something to do with Wow64 but I don't know what. Any help is greatly appreciated.

    I discovered the solution and thought I would reply to my own question so that maybe someone else will be helped. (That will probably be me in a few months when I've forgotten what I did...)
    First, based on another suggestion I got, I used Process Monitor <http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx> to trace the loading process. When I did that I noticed that a different dll - msvcr71.dll - was not being loaded. That dll lives one directory level above the jvm.dll. The problem was obviously an incomplete path. So, I added a Registry query to get JavaHome, added \bin to the path and called SetDllDirectory.

  • Error Loading JVM.dll on WinNT

    Hi
    We have recently, installed Oracle Apps 11i. While applying a patch on Apps 11i, we were getting a Java error - Error Loading: ...\classic\jvm.dll. And we are unable to apply the Apps11i patch.
    I checked the entire Server for JVM.dll, but could not find it.
    After checking this forum, I found, that, a similar BUG in Java has been reported, but most of the BUG descriptions are for WIN 95 and WIN2K and NOT for WinNT.
    Could someone help me out.
    Enviroment Info:
    Product :- Oracle Apps 11i
    Platform :- WinNT 4.0
    Regards
    Vinod

    jvm.dll should be in the <java>\bin\classic directory.
    If it's not, then I THINK there's something wrong with your java runtime environment (jre).
    Is this something you installed yourself - the java - or was it soemthing dropped on yoour system by the Oracle product?
    o former: Get a new jre.
    o Latter: Get a new jre and/or complain to Oracle.

Maybe you are looking for

  • HT3965 how do i change the iCloud account information on my iPhone?

    How do i change the iCloud Account information for an iphone.  I set up my wifes iPhone and my phone with the same iCloud Account name name.  Later, i added another phone on my ATT account for my mother, but made an Apple iCloud Account in her name. 

  • Video & Audio out of sync after update

    Ever since I updated my MacBook Pro to OS X Yosemite v10.10 last week, all videos are out of sync with the audio. It wasn't just on Safari while playing YouTube videos or DailyMotion videos, but also when playing videos files on my computer. For shor

  • How can I scan to PDF and then save as Word?

    Don't know if the above got through or not. When I scan in documents do I scan as jpg or tif when I want to convert to PDF then to MS Word?

  • System increasingly unstable

    My system has run for over 10 years without unaccounted problems. Recently however the system is less responsive and reports timeouts on interrupt: [Sat Jan 3 13:45:17 2015] perf interrupt took too long (2537 > 2495), lowering kernel.perf_event_max_s

  • App Crash with Lightroom 4.2

    Why am I getting app crashes while using LR 4.2?  I just installed the 4.2 update on Sept 3rd and already have had three crashes inside first day's use.   Crash details:  "1st crash" Problem signature: Problem Event Name:     APPCRASH Application Nam