Android build error when using Unity Ads

I’m working on an Android game that has Unity ads implemented. Whenever I try to build I get the following error.

Error building Player: Win32Exception:
ApplicationName=‘javac.exe’,
CommandLine='-bootclasspath

I’m pretty sure the problem has to do with Unity Ads specifically, because it was building just fine before I was using ads. I’ve googled this error plenty of times and came up with a lot of answers, none of which helped so far. If you know what the error means or how I can solve it, I’d really appreciate your advice.

This error was solved by adding a JAVA_HOME system environment variable. I followed the instructions on this site, with the exception of selecting the jdk location, instead of jde.

you see this video