Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch doesn't find bundled JDK #44139

Open
dandago opened this issue Jul 9, 2019 · 10 comments

Comments

@dandago
Copy link

commented Jul 9, 2019

Elasticsearch version (bin/elasticsearch --version):

7.1.1 and 7.2.0.

Version: 7.1.1, Build: default/zip/7a013de/2019-05-23T14:04:00.380842Z, JVM: 12.0.1
Version: 7.2.0, Build: default/zip/508c38a/2019-06-20T15:54:18.811730Z, JVM: 12.0.1

Plugins installed: []

Nothing extra. Just vanilla Elasticsearch.

JVM version (java -version):

Whatever is bundled with the respective versions (see Elasticsearch version output above).

OS version (uname -a if on a Unix-like system):

Windows 10 Home
Build 17134.829

Description of the problem including expected versus actual behavior:

Even though the JDK is bundled with Elasticsearch as from version 7.0, I still have to set JAVA_HOME for it to work. Elasticsearch complains that it can't find Java bundled at the directory where it actually exists. See the thread I posted at Discuss Elastic which shows the output with Elasticsearch 7.1.1.

Steps to reproduce:

  1. Open cmd.exe
  2. Navigate to the Elasticsearch bin folder
  3. Run elasticsearch.bat

Provide logs (if relevant):

N/A

@elasticmachine

This comment has been minimized.

Copy link
Collaborator

commented Jul 9, 2019

@rjernst

This comment has been minimized.

Copy link
Member

commented Jul 10, 2019

@dandago Can you please check you do not already have a JAVA_HOME set? Something like echo %JAVA_HOME% just before running elasticsearch.bat. If that is not set, can you then try running from the elasticsearch home directory instead of within the bin directory? I'm trying to narrow down where this issue might be, but I rely on our windows packaging tests, which are passing, so I'm hoping to get some more data points to help in crafting a test that would fail.

@dandago

This comment has been minimized.

Copy link
Author

commented Jul 10, 2019

@rjernst You are right, I did have JAVA_HOME set to a directory that no longer exists. It works if I clear it.

In this case, I'm afraid the error:

could not find java in JAVA_HOME or bundled at C:\tools\elasticsearch-7.1.1\jdk

...is misleading. I would have thought that if it fails to find the JDK in JAVA_HOME then it would look for the bundled one (which exists at the directory it is mentioning), but it seems to be relying entirely on JAVA_HOME if it is set.

@1044886782

This comment has been minimized.

Copy link

commented Jul 26, 2019

image
this is my problem , i can't figure it out...

@1044886782

This comment has been minimized.

Copy link

commented Jul 26, 2019

image
this is my problem , i can't figure it out...

I finally find a way to slove this probem: the url is:https://stackoverflow.com/questions/49012969/could-not-find-java-home-elastcisearch

execute this command: set JAVA_HOME=D:\java

@cawoodm

This comment has been minimized.

Copy link

commented Aug 13, 2019

This is still an issue (Windows 10) ES 7.3.0:
image

As you can see it can find java (where it says it can't) only if we set JAVA_HOME.

In my case JAVA_HOME was already set to a JRE path so, if ES doesn't like that, it should find it's own packaged JDK.

@rjernst

This comment has been minimized.

Copy link
Member

commented Aug 13, 2019

@cawoodm If JAVA_HOME is set, Elasticsearch will use that. There is no attempt to discern whether the version of is meant to be used with Elasticsearch. If you don't mean to use that java with Elasticsearch, unset JAVA_HOME when starting ES.

@1044886782

This comment has been minimized.

Copy link

commented Aug 14, 2019

@cawoodm If JAVA_HOME is set, Elasticsearch will use that. There is no attempt to discern whether the version of is meant to be used with Elasticsearch. If you don't mean to use that java with Elasticsearch, unset JAVA_HOME when starting ES.

Yes,I've sloved this problem by setting this PATH,thanks.

@dandago

This comment has been minimized.

Copy link
Author

commented Aug 14, 2019

@rjernst

@cawoodm If JAVA_HOME is set, Elasticsearch will use that. There is no attempt to discern whether the version of is meant to be used with Elasticsearch. If you don't mean to use that java with Elasticsearch, unset JAVA_HOME when starting ES.

If this is the behaviour, then the error shouldn't claim that it checked for the bundled JDK.

@rjernst

This comment has been minimized.

Copy link
Member

commented Aug 14, 2019

If this is the behaviour, then the error shouldn't claim that it checked for the bundled JDK.

I agree. The existing error message is a result of only slightly changing the old error message where we looked for JAVA_HOME and on the PATH. I will separate this out so it is clear when JAVA_HOME was used and that the path does not exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.