Amrit
Amrit

Reputation: 21

java error installing running elastic stack in Windows 10

I try to run elastic stack in windows 10 but I get the error:

"warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME" "could not find java in JAVA_HOME at "C:\Program Files\Java\jdk-15\bin\bin\java.exe""

My java.exe is located in C:\Program Files\Java\jdk-15\bin\java.exe which is slightly different than above but all of my other java programs seem to work.

How do I fix this so that Elastic Stack will work?

Upvotes: 1

Views: 5189

Answers (5)

Baishan Zhou
Baishan Zhou

Reputation: 1

I had the same issue and I changed the content of elasticsearch-env.bat and it worked.

you can alter elasticsearch-env.bat file, change from

if defined ES_JAVA_HOME (
  set JAVA="%ES_JAVA_HOME%**\bin**\java.exe"
  set JAVA_TYPE=ES_JAVA_HOME
) else if defined JAVA_HOME (
  rem fallback to JAVA_HOME
  echo "warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME" >&2
  set JAVA="%JAVA_HOME%**\bin**\java.exe"
  set "ES_JAVA_HOME=%JAVA_HOME%"
  set JAVA_TYPE=JAVA_HOME

to

if defined ES_JAVA_HOME (
  set JAVA="%ES_JAVA_HOME%\java.exe"
  set JAVA_TYPE=ES_JAVA_HOME
) else if defined JAVA_HOME (
  rem fallback to JAVA_HOME
  echo "warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME" >&2
  set JAVA="%JAVA_HOME%\java.exe"
  set "ES_JAVA_HOME=%JAVA_HOME%"
  set JAVA_TYPE=JAVA_HOME

Upvotes: 0

Asilkan
Asilkan

Reputation: 1

First, make sure you have installed Java correctly. Set the JAVA_HOME variable to specify the path to Java in your Windows environment variables and add it to the PATH. If these didn't work, try the following way.

1-Go to C:\elasticsearch-version\bin
2-Open elasticsearch-env.bat for Windows with a text editor
3-Find the set JAVA_HOME variables and remove the extra "\bin" added to the JAVA path you defined.

This is because you define JAVA_HOME as "C:\Program Files\Java\jdk\bin". You can also solve the problem by removing the "\bin" here. However, this can cause other problems.

Upvotes: 0

Ajay Nikumbh
Ajay Nikumbh

Reputation: 11

You'r facing this problem due to wrong java folder location. Change or move your java folder to program files/Java and updated java path to ur system path and this will solve your problem .. !! This worked for me..

Upvotes: 1

Hadi rezaei zadeh
Hadi rezaei zadeh

Reputation: 16

First chack your JAVA_HOME, it shoud point to "C:\Program Files\Java\jdk-15"

if you open service.bat you will see elasticsearch use %JAVA_HOME%\bin\java.exe, so your JAVA_HOME shoud not have \bin part.

Upvotes: 0

CptnFlipFlops
CptnFlipFlops

Reputation: 9

Try using the docker ELK Stack instead installing everything manually - https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

And you can run this in a VirtualBox instance of Fedora or Ubuntu so that you don't break your windows environment.

Upvotes: 0

Related Questions