Sitecore Solr 7.2.1 with JDK 12.0

So i have been working on setting up a Solr 7.2.1 single instance, as you would know one of the per-requisities is to have Java available in your server to run Solr successfully. If you have ever deployed Solr 7.2.1 then you would know that Java 9 is required but that’s not being updated anymore and you will have issues when a VAPT test is done

As far as my research says there’s a bug or perhaps the ways it’s written is that it would go and look for only certain version of Java, the community has raised it with Solr team and here’s the link to the issue reported and the response.

Alright, come to the point, if you want to run newer version like Java 11 or Java 12 then you will have to make couple of changes in your Solr.cmd as show below, so make sure you have the backup done.

Please note i am not Java educated so everything that i have figured out is using google and doing multiple trial and errors, so please ignore the ugly hacks or if you feel that’s not a good practice.

So the first issue that you will see is when you install latest version of Java and when you run the Solr instance through command line.

ERROR: Java 1.8 or later is required to run Solr. Current Java version is: 12.0.2

Which means Solr is looking for specific version and cannot understand the latest version, so here’s what you got to do.

In solr.cmd the piece of code that you need to find out and change is.

REM Extract the major Java version, e.g. 7, 8, 9, 10 ...
for /f "tokens=1,2 delims=." %%a in ("!JAVA_VERSION_INFO!") do (
  if "%%a" GEQ "9" (
  ) else (

Change the line that looks like:

if "%%a" GEQ "9" (


if %%a GEQ 9 (

Now you mind get second error which would be something like:

UseConcMarkSweepGC was deprecated

In this case you will have to find out another piece of line and delete.

-XX:+UseParNewGC ^

Just get rid of that line, reboot your server, make sure JAVA “Path” and JAVA_HOME path is set in environment variables and you should be good to go.

Leave a Reply

Your email address will not be published. Required fields are marked *