How to specify the JDK when starting ES?

To specify the JDK to start ES, you can follow these steps:

  1. First, make sure that the appropriate JDK version is installed. Type java -version in the command line, if the correct JDK version information is displayed, then it means it has been successfully installed.
  2. Open the installation directory of Elasticsearch and locate the jvm.options file in the config folder.
  3. Open the jvm.options file with any text editor and locate the line that starts with #jdk.tls.ephemeralDHKeySize.
  4. Add the following content after the line #jdk.tls.ephemeralDHKeySize:
# 指定 JDK 路径
# 注意:路径中的双引号是必需的,用于处理路径中的空格问题
# 修改为你的 JDK 路径
# path.to.jdk="/path/to/jdk"

Replace the location in path.to.jdk with the actual JDK path. Make sure the path is enclosed in double quotes and there are no comment symbols #.

  1. Save and close the jvm.options file.
  2. Now, start Elasticsearch using the specified JDK. Navigate to the installation directory of Elasticsearch in the command line and execute the following command:
./bin/elasticsearch

This will start Elasticsearch using the specified JDK.

Please note that this is the manual method for specifying the JDK to start Elasticsearch. Additionally, if Elasticsearch has already found the default JDK in the environment variables, manually specifying the JDK may not work. In this case, you may need to resolve it by adjusting the environment variables.

bannerAds