JuliaInterop / JavaCall.jl

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

“No Java runtime present, requesting install.” message on MacOS Catalina #100

Closed KenziTrader closed 4 years ago

KenziTrader commented 4 years ago

On MacOS Catalina I'm seeing the dialog “No Java runtime present, requesting install.” in JavaCall.jl when my Java code executes .getDeclaredConstructor().newInstance(). Julia terminates at this point. I tried with Julia 1.3.0 and 1.3.1. The code does work correctly in our non-Julia application. Also all tests in ]test JavaCall pass.

I've tried several JDK versions, all producing the dialog.

It's not possible to install the legacy Java 6 runtime anymore.

This used to work and I don't understand what update is causing the dialog.

Does anybody have an idea how to solve this?

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

(v1.3) pkg> status JavaCall
    Status `~/.julia/environments/v1.3/Project.toml`
  [864edb3b] DataStructures v0.17.7
  [494afd89] JavaCall v0.7.2
  [ade2ca70] Dates 
⋊> ~/D/W/S/E/2020-jan-03 java --version                                                                                                                                                                                                         16:50:48
openjdk 11.0.1 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
aviks commented 4 years ago

Do you have the full JDK installed, rather than just the JRE? Do you have JAVA_HOME defined, pointing to the JDK directory?

Sorry to see that you are having problems, but Catalina is such a mess, I've moved away from OSX :(

KenziTrader commented 4 years ago

I have the full JDK installed and have correctly defined JAVA_HOME. There are no problems using the JDK with Eclipse. Also all tests in ]test JavaCall pass.

I can run the code from Eclipse or an assembly.

From JavaCall.jl it crashes on a . newInstance() call.

aviks commented 4 years ago

I'll try and take a look, but can't promise a timeline, sorry, since I can't replicate this easily. If you can, it will be good to check if .newInstance() works from a simple C/JNI code.

KenziTrader commented 4 years ago

No problem.

I tried a simple example with .newInstance() and it works.

It seems that my Java code crashes because it cannot load some jar-file. It used to work before the holidays. I don't understand why MacOS shows the Java 6 dialog and does not generate a ClassNotFoundException. My suspicion is that the problem is with the BLAS library.

I just wish that Julia would work with GraalVM. As Julia is based on LLVM and GraalVM can execute LLVM bitcode it should be posible.

KenziTrader commented 4 years ago

The problem was with loading the right netlib-java libraries. I now force to use the Java implementation as performance is not important

  JavaCall.addOpts("-Dcom.github.fommil.netlib.BLAS=com.github.fommil.netlib.F2jBLAS")
  JavaCall.addOpts("-Dcom.github.fommil.netlib.LAPACK=com.github.fommil.netlib.F2jLAPACK")
  JavaCall.addOpts("-Dcom.github.fommil.netlib.ARPACK=com.github.fommil.netlib.F2jARPACK")
aviks commented 4 years ago

Can we close this now?