java.interop icon indicating copy to clipboard operation
java.interop copied to clipboard

Fix jvm loading on windows

Open radekdoulik opened this issue 5 years ago • 0 comments

Currently jvm creation/loading with Java.Interop.JreRuntime.CreateJreVM doesn't work on Windows.

error JM4003: jnimarshalmethod-gen: Unable to create Java VM
System.Exception: Could not load JVM path `C:\Users\rodo\android-toolchain\jdk-1.8\jre\bin\server\jvm.dll`: The specified module could not be found.
 (-1002)!
   at Java.Interop.JreRuntime.CreateJreVM(JreRuntimeOptions builder) in C:\Users\rodo\git\java.interop\src\Java.Runtime.Environment\Java.Interop\JreRuntime.cs:line 101
   at Java.Interop.JreRuntime..ctor(JreRuntimeOptions builder) in C:\Users\rodo\git\java.interop\src\Java.Runtime.Environment\Java.Interop\JreRuntime.cs:line 138
   at Java.Interop.JreRuntimeOptions.CreateJreVM() in C:\Users\rodo\git\java.interop\src\Java.Runtime.Environment\Java.Interop\JreRuntime.cs:line 74
   at Xamarin.Android.Tools.JniMarshalMethodGenerator.App.CreateJavaVM(String jvmDllPath) in C:\Users\rodo\git\java.interop\tools\jnimarshalmethod-gen\App.cs:line 220
ls C:\Users\rodo\android-toolchain\jdk-1.8\jre\bin\server\jvm.dll


    Directory: C:\Users\rodo\android-toolchain\jdk-1.8\jre\bin\server

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---            3/6/2019 11:39 AM        8501256 jvm.dll

Dependencies:

dumpbin.exe /dependents android-toolchain\jdk-1.8\jre\bin\server\jvm.dll
Microsoft (R) COFF/PE Dumper Version 14.27.29110.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file android-toolchain\jdk-1.8\jre\bin\server\jvm.dll

File Type: DLL

  Image has the following dependencies:

    KERNEL32.dll
    USER32.dll
    ADVAPI32.dll
    WSOCK32.dll
    WINMM.dll
    VERSION.dll
    PSAPI.DLL
    MSVCR100.dll

  Summary

       72000 .data
       45000 .pdata
      1B2000 .rdata
       32000 .reloc
        1000 .rsrc
      5A9000 .text

Might be related to https://github.com/xamarin/java.interop/commit/08ff4db188787b7d72fb1976f1511d0b76125415

So far I think that some of the jvm.dll dependencies are not loaded. Need to find a way to debug the dll loading process on Windows.

radekdoulik avatar Sep 11 '20 08:09 radekdoulik