6

I need to use elasticsearch in a remote server which have a jdk 1.7 and my ES 5.4 support jdk 1.8

so I need to configure it to point to path for JDK 1.8 I cant update JAVA_HOME

can you please tell me how can I do it ? which file shoud I update

YK mar
  • 669
  • 2
  • 10
  • 32

2 Answers2

7

Assuming you already download JDK and extract it separately to path /usr/java

edit the file /usr/share/elasticsearch/bin/elasticsearch-env

# now set the path to java
#if [ -x "$JAVA_HOME/bin/java" ]; then
#  JAVA="$JAVA_HOME/bin/java"
#else
#  set +e
#  JAVA=`which java`
#  set -e
#fi

#if [ ! -x "$JAVA" ]; then
#  echo "could not find java; set JAVA_HOME or ensure java is in PATH"
#  exit 1
#fi

and comment above Java check and error areas.

at the top of the file /usr/share/elasticsearch/bin/elasticsearch

JAVA=/usr/java/jdk1.8.0_151/bin/java

Add Java path.

  • If you are using windows, follow these steps in elasticsearch-env.bat. Add set JAVA= and remove the check – Leena Jan 07 '22 at 06:31
0

file to update JAVA_HOME by JAVA_ES

and I create JAVA_ES and I put any version of java I need

exmpl:
    IF DEFINED JAVA_ES (
      set JAVA="%JAVA_ES%\bin\java.exe"
    ) ELSE (
      FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I
    )

elasticsearch.in.bat
elasticsearch-keystore.bat
elasticsearch-plugin.bat
elasticsearch-service.bat
elasticsearch-translog.bat

I didnt verify if just one of these is sufficient, but I updated all

thanks

YK mar
  • 669
  • 2
  • 10
  • 32