I try to run lean local live trading(lean live) using Interactive Broker paper account, but run into error:  No suitable Java Virtual Machine could be found on your system. The version of the JVM must be1.8.0_152.

Looks like this is IBGateway process try to locate Java 1.8 inside Lean VM?  

I login to Lean VM and check java -version, looks like there do have Java 1.8 inside VM. 

But why the IBGateway process can not locate it?  How can I set the JAVA_HOME to /usr/lib/jvm/java-8-openjdk-arm64 so IBGateway can pickup the right Java. 

(I am using Macbook M1, not sure if this is M1 specific issue?)

# java -versionopenjdk version "1.8.0_312"OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~20.04-b07)OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)

 

Full error log:

20220707 20:44:54.941 TRACE:: InteractiveBrokersBrokerage.InteractiveBrokersBrokerage(): Starting IB Automater...20220707 20:44:54.949 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Setting execute permissions onIBAutomater.sh20220707 20:44:54.960 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): chmod +x IBAutomater.sh: processexit code: 020220707 20:44:54.962 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Loading IBGateway - Version: 985 -Path: /root/ibgateway - User:  p20220707 20:44:54.964 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Searching for TWS JRE path20220707 20:44:54.965 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Install4J path:/root/ibgateway/.install4j20220707 20:44:54.967 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): File not found:/root/ibgateway/.install4j/pref_jre.cfg20220707 20:44:54.968 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): File found:/root/ibgateway/.install4j/inst_jre.cfg20220707 20:44:54.970 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Directory found:/usr/lib/jvm/java-8-openjdk-arm64/jre20220707 20:44:54.972 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Updating IBGateway ini file:/root/Jts/jts.ini20220707 20:44:54.974 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Updating IBGateway configurationfile: /root/ibgateway/ibgateway.vmoptions20220707 20:44:54.983 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): IBAutomater process started - Id:157- Name:IBAutomater.sh - InitializationTimeout:00:15:0020220707 20:44:54.986 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): UID        PID  PPID  C    SZ   RSSPSR STIME TTY          TIME CMD20220707 20:44:54.987 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root         1     0 62 5660961370732 0 20:44 pts/0   00:00:03 dotnet QuantConnect.Lean.Launcher.dll20220707 20:44:54.988 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root       157     1  0  2379  28683 20:44 pts/0    00:00:00   /bin/bash /Lean/Launcher/bin/Debug/IBAutomater.sh /root/ibgateway20220707 20:44:54.989 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root       158   157  0  2844  27802 20:44 pts/0    00:00:00     ps -AFH20220707 20:45:00.005 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): UID        PID  PPID  C    SZ   RSSPSR STIME TTY          TIME CMD20220707 20:45:00.009 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root         1     0 37 5660961371488 3 20:44 pts/0   00:00:04 dotnet QuantConnect.Lean.Launcher.dll20220707 20:45:00.010 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root       157     1  0  2379  29523 20:44 pts/0    00:00:00   /bin/bash /Lean/Launcher/bin/Debug/IBAutomater.sh /root/ibgateway20220707 20:45:00.013 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): root       162   157  0  2844  28200 20:44 pts/0    00:00:00     ps -AFH20220707 20:45:00.120 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): No suitable Java Virtual Machinecould be found on your system.20220707 20:45:00.123 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): The version of the JVM must be1.8.0_152.20220707 20:45:00.123 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): IBGateway process exited20220707 20:45:00.141 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterOutputDataReceived(): Please define INSTALL4J_JAVA_HOME topoint to a suitable JVM.20220707 20:45:00.148 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterExited(): Exit code: 020220707 20:45:00.150 TRACE:: InteractiveBrokersBrokerage.OnIbAutomaterExited(): IBGateway close detected, restarting