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

2
  • maybe it's not the best solution, but you can modify elasticsearch.in file (elasticsearch_directory/bin) and set JAVA variable here Commented Feb 1, 2018 at 15:03
  • How have you installed elasticsearch? tar ball or rpm or deb or ?? Commented Feb 1, 2018 at 20:56

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

If you are using windows, follow these steps in elasticsearch-env.bat. Add set JAVA=<path> and remove the check
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.