I wanted to install Solr 6.0.1 on my brand new laptop for Sitecore 8.2 after I already installed Solr 7.2.1 for Sitecore 9.1. I thought it will be easy because I have already a Java environment installed. I had 2 issues.
1. The obvious – “Java 1.8 or later is required to run Solr. Current Java version is: 9.0.1”
So, solr.cmd says 9.0.1 is lower than 1.8, yeah, I see… This does not make any sense, so I just commented out the following lines from bin\solr.cmd because I know I have a correct version.
|REM IF !JAVA_MAJOR_VERSION! LSS 8 (|
|REM set "SCRIPT_ERROR=Java 1.8 or later is required to run Solr. Current Java version is: !JAVA_VERSION_INFO!"|
|REM goto err|
Great, problem solved, yeah, this problem actually, then the next problem popped up:
2. The surprise – “Unrecognized VM option ‘PrintHeapAtGC'”
Alright, I thought then I need to comment out some more lines from the bin\solr.cmd. But no because there were not search result in the file for “PrintHeapAtGC”. Just to be clear the exact error message was the following:
|Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.|
|Java HotSpot(TM) 64-Bit Server VM warning: Option UseParNewGC was deprecated in version 9.0 and will likely be removed in a future release.|
|Unrecognized VM option 'PrintHeapAtGC'|
|Error: Could not create the Java Virtual Machine.|
|Error: A fatal exception has occurred. Program will exit.|
So, I checked the other files and I found this bastard in the bin\solr.in.cmd. I had to modify the parameters of GC_LOG_OPTS to the following:
|REM Original command|
|REM set GC_LOG_OPTS=-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime|
|REM Modified command|
|set GC_LOG_OPTS=-verbose:gc -XX:+PrintGCDetails|
I don’t know if it will cause any problem on a local machine for Sitecore development but don’t do it on production for sure! Hope it helped you out.