Sandbox error -- multiple java versions on Windows

Hi ,

When I am using openJDK Java in one machine sandbox is working fine .
But when I am using SDK in the machine with java from oracle provider I am getting following error.
Caused by: java.lang.UnsupportedClassVersionError: com/github/blemale/scaffeine/CacheLoaderAdapter has been compiled by a more
recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Is there any dependency to use only OpenJDK. ?

Note :In both machines SDK version is 2.1.1 and java version is 11.0.8

Regards
Harikrishna

Class file version 52.0 is Java 8. So it sounds like your oracle JDK somehow is version 8 rather than 11.0.8.

How are you starting Sandbox?

Can you check the output of these two commands:

java -version
echo $JAVA_HOME

Hi ,

Thanks for the response.

I am starting the sandbox using DAML START.

below is the output for java -version

java version “11.0.18” 2023-01-17 LTS
Java™ SE Runtime Environment 18.9 (build 11.0.18+9-LTS-195)
Java HotSpot™ 64-Bit Server VM 18.9 (build 11.0.18+9-LTS-195, mixed mode)

below is the output for next command
echo $JAVA_HOME
$JAVA_HOME

Regrds
Harikrishna

Which operating system are you running on?

windows 10

Can you please run this from the same powershell session you’re running Daml start from:

echo $Env:PATH
echo $Env:JAVA_HOME

below is the result of the commands

PS H:> echo $Env:PATH

C:\Program Files\Common Files\Oracle\Java\javapath;

C:\WINDOWS\CCM;

C:\WINDOWS\system32;

C:\WINDOWS;

C:\WINDOWS\System32\Wbem;

C:\WINDOWS\System32\WindowsPowerShell\v1.0;

C:\WINDOWS\System32\OpenSSH;C:\Program Files\dotnet;

C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;

C:\Program Files\git\bin;

C:\Program Files (x86)\Webex\Plugins;

C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm;

C:\Program Files\nodejs\16.17.1;

;C:\Program Files\org1\VSCode\1.74.2\bin;

C:\Program Files\org1\VSCode\1.74.2;

C:\Users\username\AppData\Local\Microsoft\WindowsApps;

C:\Program Files\Java\jdk11\bin;

C:\Users\username\AppData\Roaming\daml\bin;

PS H:> echo $Env:JAVA_HOME

C:\Program Files\Java\jdk11\bin

Hi @harikrishna_sri_ramo,

Could you please check that java.exe is not present in your C:\WINDOWS\System32 folder? Do you have System Administrator rights on the machine you get this error?

Hi @Mate_Varga

I don’t have system rights .
Java.exe is present in the the mentioned folder

Regards
Harikrishna

The question is not whether or not do you have java.exe installed, it is whether or not do you have a system managed version of it in your C:\WINDOWS\System32. If you do, that takes over the precedence whenever you run the daml assistant and it calls out to execute jars, but does not do when you execute from your interactive session.

Hi @Mate_Varga

Thanks for the response .
Could you please elaborate , I am unable to understand your point clearly.
I don’t have system admin rights.
There are three files java.exe javaw.exe javaws.exe files.

Regards
Harikrishna

Can you run

C:\WINDOWS\System32\java.exe -version
1 Like

Hi @cocreature
Thank for the response.
below is the output

java version “1.8.0_351”
Java™ SE Runtime Environment (build 1.8.0_351-b25)
Java HotSpot™ 64-Bit Server VM (build 25.351-b25, mixed mode)

Regards
Harikrishna

There is your issue. It looks like that’s the Java version that is being picked up. Can you reach out to whoever has admin rights on your machine and ask them to remove this version?

2 Likes

Thank you very much for your support.