JuliaInterop / JavaCall.jl

Call Java from Julia
http://juliainterop.github.io/JavaCall.jl
Other
118 stars 53 forks source link

Error when loading JDK 15 x64 on Windows with Julia 1.6 RC 1 #138

Closed dourouc05 closed 3 years ago

dourouc05 commented 3 years ago

I just installed the latest JDK x64 from Oracle (https://download.oracle.com/otn-pub/java/jdk/15.0.2+7/0d1cfde4252546c6931946de8db48ee2/jdk-15.0.2_windows-x64_bin.exe, to be precise) on Windows 10, along with Julia 1.6 RC1 x64. However, loading the package fails:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0-rc1 (2021-02-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using JavaCall

julia> JavaCall.init()
ERROR: could not load library "C:\Program Files\Java\jdk-15.0.2\bin\server\jvm.dll"
The specified module could not be found.
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl .\libdl.jl:114
  [2] dlopen
    @ .\libdl.jl:114 [inlined]
  [3] _broadcast_getindex_evalf
    @ .\broadcast.jl:648 [inlined]
  [4] _broadcast_getindex
    @ .\broadcast.jl:621 [inlined]
  [5] #19
    @ .\broadcast.jl:1098 [inlined]
  [6] ntuple
    @ .\ntuple.jl:48 [inlined]
  [7] copy
    @ .\broadcast.jl:1098 [inlined]
  [8] materialize
    @ .\broadcast.jl:883 [inlined]
  [9] load_libjvm
    @ ~\.julia\packages\JavaCall\aVXyt\src\JNI.jl:177 [inlined]
 [10] init_new_vm(libpath::Tuple{String}, opts::OrderedCollections.OrderedSet{String})
    @ JavaCall.JNI ~\.julia\packages\JavaCall\aVXyt\src\JNI.jl:139
 [11] _init(opts::OrderedCollections.OrderedSet{String})
    @ JavaCall ~\.julia\packages\JavaCall\aVXyt\src\jvm.jl:286
 [12] init()
    @ JavaCall ~\.julia\packages\JavaCall\aVXyt\src\jvm.jl:272
 [13] top-level scope
    @ REPL[1]:1

julia> versioninfo()
Julia Version 1.6.0-rc1
Commit a58bdd9010 (2021-02-06 15:49 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)

The jvm.dll file exists:

image

mkitti commented 3 years ago

Do earlier versions of Julia or Java have a similar problem?

My suspicion is that jvm.dll depends on another DLL which is not on the Windows path.

dourouc05 commented 3 years ago

I already tried Julia 1.5.3 and JDK 15.0.2 (all x64), on another machine (still Windows 10), without troubles:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using JavaCall

julia> JavaCall.init()

julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Xeon(R) Silver 4116 CPU @ 2.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake-avx512)
mkitti commented 3 years ago

Does this work in Julia 1.6?

using Libdl
Libdl.open(raw"C:\Program Files\Java\jdk-15.0.2\bin\server\jvm.dll")

If not we may need to create an issue for Julia itself.

dourouc05 commented 3 years ago

It works on both machines. The first one (for which I opened this issue) just updated from Windows 10 1909 to 2009, and the issue no more happens.

mkitti commented 3 years ago

You are blowing my mind a bit. It sounds like the issue was resolved by a Windows update. Should we close this issue then?

dourouc05 commented 3 years ago

Maybe that version of the JDK was built with a Windows SDK that didn't support Windows 10 1909? That would be strange, but possible.

Well, at least, if someone has the same issue, then it's somewhat documented!