Elasticsearch 7.2.0. homebrew install on mac java error on startup fail

so, I got it started, but still hack
export JAVA_HOME=/usr/bin/java elasticsearch
could not find java in JAVA_HOME or bundled at /usr/bin/java/bin/java

peeling it down:
$export JAVA_HOME=/usr . (somewhat unusual, but works)

$ elasticsearch
Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...
future versions of Elasticsearch will require Java 11; your Java version from [/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre] does not meet this requirement
Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...
Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...
Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file logs/gc.log due to No such file or directory
[2019-07-29T13:26:54,308][WARN ][o.e.c.l.LogConfigurator ] [flazar-mac] Some logging configurations have %marker but don't have %node_name. We will automatically add %node_name to the pattern to ease the migration for users who customize log4j2.properties but will stop this behavior in 7.0. You should manually replace %node_name with [%node_name]%marker in these locations:
/usr/local/etc/elasticsearch/log4j2.properties

...

So, the brew install

  • has JVM options incompatible with the embedded (OpenJDK) VM
  • missing creating the the logs folder (but that might be ok, it might have been created at first run.
  • elasticsearch is checking for java in the $JAVA_HOME/bin/java. but when it starts it is looking in the $JAVA_HOME, and when it doesn't find it, goes for the "system provided"
  • FYI /usr/bin/java is a link to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, so $JAVA_HOME should be /System/Library/Frameworks/JavaVM.framework/Versions/Current/, except that it doesn't have a bin/java, it has Commands/java

So there is no 'good' $JAVA_HOME spec, only one that gets you by...

unless I'm missing something....