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

**URL:** https://discuss.elastic.co/t/elasticsearch-7-2-0-homebrew-install-on-mac-java-error-on-startup-fail/192760
**Category:** Elasticsearch
**Created:** [July 29, 2019, 6:36pm UTC](https://discuss.elastic.co/t/elasticsearch-7-2-0-homebrew-install-on-mac-java-error-on-startup-fail/192760 "2019-07-29T18:36:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ferenc0521](https://avatars.discourse-cdn.com/v4/letter/f/ac8455/32.png) [@ferenc0521](https://discuss.elastic.co/u/ferenc0521)
#### Post date: [July 29, 2019, 6:36pm UTC](https://discuss.elastic.co/t/elasticsearch-7-2-0-homebrew-install-on-mac-java-error-on-startup-fail/192760/1 "2019-07-29T18:36:12Z")

</div>

> $ elasticsearch

Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]

output:

[0.002s][error][logging] Error opening log file 'logs/gc.log': No such file or directory

[0.002s][error][logging] Initialization of output 'file=logs/gc.log' using options 'filecount=32,filesize=64m' failed.

error:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

Invalid -Xlog option '-Xlog:gc\*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m', see error log for details.

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:111)

at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:79)

at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:57)

at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:89)  
\<

---

<div class="post-metadata">

### Author: ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)
#### Post date: [July 29, 2019, 7:30pm UTC](https://discuss.elastic.co/t/elasticsearch-7-2-0-homebrew-install-on-mac-java-error-on-startup-fail/192760/2 "2019-07-29T19:30:06Z")

</div>

I'm not able to reproduce this locally. Could you please provide some more information about your environment? In particular, whether you have JAVA\_HOME set (and if so what version of java), as well as your MacOS version?

---

<div class="post-metadata">

### Author: ![ferenc0521](https://avatars.discourse-cdn.com/v4/letter/f/ac8455/32.png) [@ferenc0521](https://discuss.elastic.co/u/ferenc0521)
#### Post date: [July 29, 2019, 7:59pm UTC](https://discuss.elastic.co/t/elasticsearch-7-2-0-homebrew-install-on-mac-java-error-on-startup-fail/192760/3 "2019-07-29T19:59:20Z")

</div>

It is MacOS Mojave 10.14.3

$ echo $JAVA\_HOME  
/usr/bin/java  
$ java -version  
java version "1.8.0\_192"  
Java(TM) SE Runtime Environment (build 1.8.0\_192-b12)  
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

But the interesting thing is that the error seems to indicate OpenJDK:

> OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.  
> Invalid -Xlog option '-Xlog:gc\*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m', see error log for details.

[0.002s][error][logging] Error opening log file 'logs/gc.log': No such file or directory  
seems to indicate missing logs folder somewhere

I followed  
[Announcing the official Elastic Homebrew tap for macOS | Elastic Blog](https://www.elastic.co/blog/official-elastic-homebrew-tap-package-manager-macos),  
Installed with:  
brew tap elastic/tap  
brew install elasticsearch-full

According to the recipe, this should install elasticsearch into:  
/usr/local/Cellar/elasticsearch-full/7.2.0/  
and true, there is only bin and libexec directories there.  
Should the logs directory be here?

---

<div class="post-metadata">

### Author: ![ferenc0521](https://avatars.discourse-cdn.com/v4/letter/f/ac8455/32.png) [@ferenc0521](https://discuss.elastic.co/u/ferenc0521)
#### Post date: [July 29, 2019, 9:09pm UTC](https://discuss.elastic.co/t/elasticsearch-7-2-0-homebrew-install-on-mac-java-error-on-startup-fail/192760/4 "2019-07-29T21:09:29Z")

</div>

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....

---

<div class="post-metadata">

### Author: ![unilynx](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/unilynx/32/52098_2.png) [@unilynx](https://discuss.elastic.co/u/unilynx)
#### Post date: [August 12, 2019, 8:59am UTC](https://discuss.elastic.co/t/elasticsearch-7-2-0-homebrew-install-on-mac-java-error-on-startup-fail/192760/5 "2019-08-12T08:59:41Z")

</div>

I hit a similar issue with -Xlog, brew and Elasticsearch 7.3. Removing lines referring to -Xlog from /usr/local/etc/elasticsearch/jvm.options resolved it.

It looks like that file persisted from earlier elasticsearch installs (6.x?) and was now incompatible with 7.3, so I just uninstalled ES7.3, removed /usr/local/etc/elasticsearch completely and reinstalled ES7.3 to get a fresh start.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 9, 2019, 9:00am UTC](https://discuss.elastic.co/t/elasticsearch-7-2-0-homebrew-install-on-mac-java-error-on-startup-fail/192760/6 "2019-09-09T09:00:01Z")

</div>

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