Having spent some time deploying instances of Java for Solr servers recently, I came across two things that wasted my time. So...
You can pick the approriate release from there, and click through to get the list of downloadable files to choose from. If you're downloading manually, you can just pick the archive you need – but if you're automating it you have to be a bit careful. My initial thought was:
Start-BitsTransfer "https://github.com/ojdkbuild/ojdkbuild/releases/download/1.8.0.212-1/java-1.8.0-openjdk-1.8.0.212-1.b04.ojdkbuild.windows.x86_64.zip" "jdk.zip"
But that doesn't work:
Start-BitsTransfer : The resource loader cache doesn't have loaded MUI entry. (Exception from HRESULT: 0x80073B01) At line:1 char:1 + Start-BitsTransfer "https://github.com/ojdkbuild/ojdkbuild/releases/d ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Start-BitsTransfer], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand
After a lot of tedious googling, it turns out GitHub hosts downloads in Amazon's cloud, and that involves some redirects that don't play nicely with BITS transfers...
So – BITS is out, unless you're able to mess with system-level settings. And, you probably don't. So it's simpler to stick with a simple web request:
Invoke-WebRequest "https://github.com/ojdkbuild/ojdkbuild/releases/download/1.8.0.212-1/java-1.8.0-openjdk-1.8.0.212-1.b04.ojdkbuild.windows.x86_64.zip" -OutFile "jdk.zip"
That will get you your download without any pesky errors...
So if you're not using an installer for Java, you have to make two key settings for SolrCloud to be happy:
JAVA_HOME
environment variable is setBIN
folder to the pathFor both of these, you need to take note of scope. Make sure you understand whether you are (or want to) be setting them for the current user, or for the system overall. Generally, if you're running stuff as a service, you need the environment variables it depends on set in system scope, so they're available when the code is not running as your user. And remember that changes to environment variables are not automatically reflected in any other windows you have open already – so you may need to re-open stuff, or reboot to make sure everything ends up in the state you want.
For the
JAVA_HOME
variable, you need to make sure it points to the JRE folder. If you downloaded the Java JDK then this is a child folder of what you unzipped. But if you only downloaded the JRE package then the environment variable needs to point to the folder you've extracted. In both cases, the
bin
folder you're adding to your path is a child of the JRE folder.
If you download the "JRE only" archive then that looks like:
But if you pick the "full JDK" one then the JRE one here will have siblings containing all the other bits of the JDK. (And it will just be called "JRE" rather than having the full release name)
↑ Back to top