Error: Java 1.7 or later is required to run solr

ERROR: Java 1.7 or later is required to run solr
Please set the JAVA_HOME environment variable to the path where you installed Java 1.7+

Advertisements

ISSUE:

During the installation and setup of Solr, I faced the following error during one of the instances when booting up Solr using the following command line statement:

solr start -p 8983

ERROR: Java 1.7 or later is required to run solr

Interestingly this error came up when mixing Solr 4.10.1 with JDK 13.0.1 and JDK 8u231. However, there is a possibility that this error could occur with other versions as well.

RESOLUTION:

  1. Navigate to the bin folder under the extracted Solr folder (ex. D:\solr-4.10.1\bin) and locate solr.cmd file
  2. Edit the solr.cmd file and comment (by prefixing REM) or delete the following lines:

REM Verify Java is available
if NOT DEFINED JAVA_HOME goto need_java_home
“%JAVA_HOME%”\bin\java -version:1.8 -version > nul 2>&1
IF ERRORLEVEL 1 “%JAVA_HOME%”\bin\java -version:1.7 -version > nul 2>&1
IF ERRORLEVEL 1 goto need_java_vers
set “JAVA=%JAVA_HOME%\bin\java”

REM See SOLR-3619
IF EXIST “%SOLR_TIP%\server\start.jar” (
set “DEFAULT_SERVER_DIR=%SOLR_TIP%\server”
) ELSE (
set “DEFAULT_SERVER_DIR=%SOLR_TIP%\example”
)

You can now proceed to start up Solr using the following command-line argument:

solr start -p 8983

The startup would run smooth and the Solr would be available on the Port 8983.

You can then go back to the Solr.cmd file and uncomment the lines previously commented. Solr startup would still proceed to work from then on.

Tip:

During the initial setup, the following error was also observed:

Please set the JAVA_HOME environment variable to the path where you installed Java 1.7+

To fix this issue, ensure that you have the following entry in the System Environment Variables:

JAVA_HOME ==> {Path to the bin folder from JDK install location}
ex. C:\Program Files\Java\jdk1.8.0_212

Environment Variable can be Added/Updated by navigating to
My Computer –> Properties –> Advanced System Settings –> Advanced –> Environment Variables

Feel free to leave a reply here...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Advertisements
Advertisements
%d bloggers like this: