How to set java path for elasticsearch

I have java-11 i want to add JAVA_HOME path in elasticsearch how can i do this i edit this in /etc/default/elasticsearch but when do GET /_cluster/stats/ it give me output

"jvm" : {
      "max_uptime_in_millis" : 105897,
      "versions" : [
        {
          "version" : "15.0.1",
          "vm_name" : "OpenJDK 64-Bit Server VM",
          "vm_version" : "15.0.1+9",
          "vm_vendor" : "AdoptOpenJDK",
          "bundled_jdk" : true,
          "using_bundled_jdk" : true,
          "count" : 1
        }
      ],

in /etc/environment file
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk/

place this export JAVA_HOME=/usr/lib/jvm/java-11-openjdk/ in elasticsearch-env file

Out of curiosity, why not using the provided one as you are using the "same" distribution "openjdk"?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.