# Homebrew / Lion NoClassDefFoundError

**URL:** <https://discuss.elastic.co/t/homebrew-lion-noclassdeffounderror/6391>\
**Category:** Elasticsearch\
**Created:** [January 15, 2012, 11:08pm UTC](https://discuss.elastic.co/t/homebrew-lion-noclassdeffounderror/6391 "2012-01-15T23:08:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jasper\_van\_Wanrooy\_C](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasper_van_wanrooy_c/32/2494_2.png) [@Jasper\_van\_Wanrooy\_C](https://discuss.elastic.co/u/Jasper_van_Wanrooy_C)\
**Post date:** [January 15, 2012, 11:08pm UTC](https://discuss.elastic.co/t/homebrew-lion-noclassdeffounderror/6391/1 "2012-01-15T23:08:41Z")

</div>

Hi,

I'm using ElasticSearch on Lion for quite some time now, but was stuck with release 0.17.7. That one worked great with Homebrew's default formula. Today I upgraded to 0.18.6, but can't get it to work. The problem I run into is that the main class could not be found. I performed the following upgrade steps:  
$ brew upgrade elasticsearch  
$ launchctl unload -w ~/Library/LaunchAgents/org.elasticsearch.plist  
$ ln -nfs /usr/local/Cellar/elasticsearch/0.18.6/org.elasticsearch.plist ~/Library/LaunchAgents/  
$ launchctl load -wF ~/Library/LaunchAgents/org.elasticsearch.plist

The elasticsearch daemon won't start. When trying to start it manually, I get a NoClassDefFoundError  
$ elasticsearch -f -D es.config=/usr/local/Cellar/elasticsearch/0.18.6/config/elasticsearch.yml  
Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/bootstrap/ElasticSearch  
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.bootstrap.ElasticSearch  
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)  
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

I read some more problems with the scripts related to the plugins, but not related to ES itself. Does anyone know what might be the problem with my environment? I use the following java version:  
$ java -version  
java version "1.6.0\_29"  
Java(TM) SE Runtime Environment (build 1.6.0\_29-b11-402-11M3527)  
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

Thanks, Jasper

---

<div class="post-metadata">

**Author:** ![David\_Woo](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@David\_Woo](https://discuss.elastic.co/u/David_Woo)\
**Post date:** [January 16, 2012, 12:28am UTC](https://discuss.elastic.co/t/homebrew-lion-noclassdeffounderror/6391/2 "2012-01-16T00:28:38Z")

</div>

hi  
i think that you should set path.home="${elasticsearch\_home}" in config file.

1. 
  1. 16., 오전 8:08, Jasper van Wanrooy - Chatventure 작성:

> Hi,
> 
> I'm using Elasticsearch on Lion for quite some time now, but was stuck with release 0.17.7. That one worked great with Homebrew's default formula. Today I upgraded to 0.18.6, but can't get it to work. The problem I run into is that the main class could not be found. I performed the following upgrade steps:  
> $ brew upgrade elasticsearc  
> $ launchctl unload -w ~/Library/LaunchAgents/org.elasticsearch.plist  
> $ ln -nfs /usr/local/Cellar/elasticsearch/0.18.6/org.elasticsearch.plist ~/Library/LaunchAgents/  
> $ launchctl load -wF ~/Library/LaunchAgents/org.elasticsearch.plist
> 
> The elasticsearch daemon won't start. When trying to start it manually, I get a NoClassDefFoundError  
> $ elasticsearch -f -D es.config=/usr/local/Cellar/elasticsearch/0.18.6/config/elasticsearch.yml  
> Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/bootstrap/Elasticsearch  
> Caused by: java.lang.ClassNotFoundException: org.elasticsearch.bootstrap.Elasticsearch  
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)  
> at java.security.AccessController.doPrivileged(Native Method)  
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)  
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)  
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)  
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 
> I read some more problems with the scripts related to the plugins, but not related to ES itself. Does anyone know what might be the problem with my environment? I use the following java version:  
> $ java -version  
> java version "1.6.0\_29"  
> Java(TM) SE Runtime Environment (build 1.6.0\_29-b11-402-11M3527)  
> Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
> 
> Thanks, Jasper

---

<div class="post-metadata">

**Author:** ![Jasper\_van\_Wanrooy\_C](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasper_van_wanrooy_c/32/2494_2.png) [@Jasper\_van\_Wanrooy\_C](https://discuss.elastic.co/u/Jasper_van_Wanrooy_C)\
**Post date:** [January 16, 2012, 11:06am UTC](https://discuss.elastic.co/t/homebrew-lion-noclassdeffounderror/6391/3 "2012-01-16T11:06:29Z")

</div>

Hi David,

Thanks for your help. I added it to the path section in the config, but unfortunately it didn't work out. Is it possible that my environment variables are incorrectly configured? Which one do I need to take a look at?

Thanks, Jasper

On 16 jan. 2012, at 01:28, [David.Woo@nexr.com](mailto:David.Woo@nexr.com) wrote:

> hi  
> i think that you should set path.home="${elasticsearch\_home}" in config file.
> 
> 1. 
> 1. 16., 오전 8:08, Jasper van Wanrooy - Chatventure 작성:
> 
> > Hi,
> > 
> > I'm using Elasticsearch on Lion for quite some time now, but was stuck with release 0.17.7. That one worked great with Homebrew's default formula. Today I upgraded to 0.18.6, but can't get it to work. The problem I run into is that the main class could not be found. I performed the following upgrade steps:  
> > $ brew upgrade elasticsearc  
> > $ launchctl unload -w ~/Library/LaunchAgents/org.elasticsearch.plist  
> > $ ln -nfs /usr/local/Cellar/elasticsearch/0.18.6/org.elasticsearch.plist ~/Library/LaunchAgents/  
> > $ launchctl load -wF ~/Library/LaunchAgents/org.elasticsearch.plist
> > 
> > The elasticsearch daemon won't start. When trying to start it manually, I get a NoClassDefFoundError  
> > $ elasticsearch -f -D es.config=/usr/local/Cellar/elasticsearch/0.18.6/config/elasticsearch.yml  
> > Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/bootstrap/Elasticsearch  
> > Caused by: java.lang.ClassNotFoundException: org.elasticsearch.bootstrap.Elasticsearch  
> > at java.net.URLClassLoader$1.run(URLClassLoader.java:202)  
> > at java.security.AccessController.doPrivileged(Native Method)  
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:190)  
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:306)  
> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)  
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> > 
> > I read some more problems with the scripts related to the plugins, but not related to ES itself. Does anyone know what might be the problem with my environment? I use the following java version:  
> > $ java -version  
> > java version "1.6.0\_29"  
> > Java(TM) SE Runtime Environment (build 1.6.0\_29-b11-402-11M3527)  
> > Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
> > 
> > Thanks, Jasper

---

<div class="post-metadata">

**Author:** ![David\_Woo](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@David\_Woo](https://discuss.elastic.co/u/David_Woo)\
**Post date:** [January 16, 2012, 2:07pm UTC](https://discuss.elastic.co/t/homebrew-lion-noclassdeffounderror/6391/4 "2012-01-16T14:07:03Z")

</div>

ok.

first of all.

check your Elasticsearch Lib Directory

Is it Empty or not? (except sigar directory)

when is lib directory empty that you should to build Elasticsearch use gradle.

When you use elasticsearch from source, you can't executed the script and start it.  
You need to build a distribution of elasticsearch and then use it.

Execute "gradlew release" and you will find the distribution under build/distribution.

1. 
  1. 16., 오후 8:06, Jasper van Wanrooy - Chatventure 작성:

> Hi David,
> 
> Thanks for your help. I added it to the path section in the config, but unfortunately it didn't work out. Is it possible that my environment variables are incorrectly configured? Which one do I need to take a look at?
> 
> Thanks, Jasper
> 
> On 16 jan. 2012, at 01:28, [David.Woo@nexr.com](mailto:David.Woo@nexr.com) wrote:
> 
> > hi  
> > i think that you should set path.home="${elasticsearch\_home}" in config file.
> > 
> > 1. 
> > 1. 16., 오전 8:08, Jasper van Wanrooy - Chatventure 작성:
> > 
> > > Hi,
> > > 
> > > I'm using Elasticsearch on Lion for quite some time now, but was stuck with release 0.17.7. That one worked great with Homebrew's default formula. Today I upgraded to 0.18.6, but can't get it to work. The problem I run into is that the main class could not be found. I performed the following upgrade steps:  
> > > $ brew upgrade elasticsearc  
> > > $ launchctl unload -w ~/Library/LaunchAgents/org.elasticsearch.plist  
> > > $ ln -nfs /usr/local/Cellar/elasticsearch/0.18.6/org.elasticsearch.plist ~/Library/LaunchAgents/  
> > > $ launchctl load -wF ~/Library/LaunchAgents/org.elasticsearch.plist
> > > 
> > > The elasticsearch daemon won't start. When trying to start it manually, I get a NoClassDefFoundError  
> > > $ elasticsearch -f -D es.config=/usr/local/Cellar/elasticsearch/0.18.6/config/elasticsearch.yml  
> > > Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/bootstrap/Elasticsearch  
> > > Caused by: java.lang.ClassNotFoundException: org.elasticsearch.bootstrap.Elasticsearch  
> > > at java.net.URLClassLoader$1.run(URLClassLoader.java:202)  
> > > at java.security.AccessController.doPrivileged(Native Method)  
> > > at java.net.URLClassLoader.findClass(URLClassLoader.java:190)  
> > > at java.lang.ClassLoader.loadClass(ClassLoader.java:306)  
> > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)  
> > > at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> > > 
> > > I read some more problems with the scripts related to the plugins, but not related to ES itself. Does anyone know what might be the problem with my environment? I use the following java version:  
> > > $ java -version  
> > > java version "1.6.0\_29"  
> > > Java(TM) SE Runtime Environment (build 1.6.0\_29-b11-402-11M3527)  
> > > Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
> > > 
> > > Thanks, Jasper

---

<div class="post-metadata">

**Author:** ![Jasper\_van\_Wanrooy\_C](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasper_van_wanrooy_c/32/2494_2.png) [@Jasper\_van\_Wanrooy\_C](https://discuss.elastic.co/u/Jasper_van_Wanrooy_C)\
**Post date:** [January 16, 2012, 4:16pm UTC](https://discuss.elastic.co/t/homebrew-lion-noclassdeffounderror/6391/5 "2012-01-16T16:16:59Z")

</div>

Thanks for your help!  
The problem was that the formula for elasticsearch has changed over time. The locations for the libs changed bacause of Homebrew conventions. I had an old .elasticsearch.in.sh file in my home directory with a reference to the old ES\_HOME. After removing all old stuff it works as expected again.

Thanks, Jasper

On 16 jan. 2012, at 15:07, [David.Woo@nexr.com](mailto:David.Woo@nexr.com) wrote:

> ok.
> 
> first of all.
> 
> check your Elasticsearch Lib Directory
> 
> Is it Empty or not? (except sigar directory)
> 
> when is lib directory empty that you should to build Elasticsearch use gradle.
> 
> When you use elasticsearch from source, you can't executed the script and start it.  
> You need to build a distribution of elasticsearch and then use it.
> 
> Execute "gradlew release" and you will find the distribution under build/distribution.
> 
> 1. 
> 1. 16., 오후 8:06, Jasper van Wanrooy - Chatventure 작성:
> 
> > Hi David,
> > 
> > Thanks for your help. I added it to the path section in the config, but unfortunately it didn't work out. Is it possible that my environment variables are incorrectly configured? Which one do I need to take a look at?
> > 
> > Thanks, Jasper
> > 
> > On 16 jan. 2012, at 01:28, [David.Woo@nexr.com](mailto:David.Woo@nexr.com) wrote:
> > 
> > > hi  
> > > i think that you should set path.home="${elasticsearch\_home}" in config file.
> > > 
> > > 1. 
> > > 1. 16., 오전 8:08, Jasper van Wanrooy - Chatventure 작성:
> > > 
> > > > Hi,
> > > > 
> > > > I'm using Elasticsearch on Lion for quite some time now, but was stuck with release 0.17.7. That one worked great with Homebrew's default formula. Today I upgraded to 0.18.6, but can't get it to work. The problem I run into is that the main class could not be found. I performed the following upgrade steps:  
> > > > $ brew upgrade elasticsearc  
> > > > $ launchctl unload -w ~/Library/LaunchAgents/org.elasticsearch.plist  
> > > > $ ln -nfs /usr/local/Cellar/elasticsearch/0.18.6/org.elasticsearch.plist ~/Library/LaunchAgents/  
> > > > $ launchctl load -wF ~/Library/LaunchAgents/org.elasticsearch.plist
> > > > 
> > > > The elasticsearch daemon won't start. When trying to start it manually, I get a NoClassDefFoundError  
> > > > $ elasticsearch -f -D es.config=/usr/local/Cellar/elasticsearch/0.18.6/config/elasticsearch.yml  
> > > > Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/bootstrap/Elasticsearch  
> > > > Caused by: java.lang.ClassNotFoundException: org.elasticsearch.bootstrap.Elasticsearch  
> > > > at java.net.URLClassLoader$1.run(URLClassLoader.java:202)  
> > > > at java.security.AccessController.doPrivileged(Native Method)  
> > > > at java.net.URLClassLoader.findClass(URLClassLoader.java:190)  
> > > > at java.lang.ClassLoader.loadClass(ClassLoader.java:306)  
> > > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)  
> > > > at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> > > > 
> > > > I read some more problems with the scripts related to the plugins, but not related to ES itself. Does anyone know what might be the problem with my environment? I use the following java version:  
> > > > $ java -version  
> > > > java version "1.6.0\_29"  
> > > > Java(TM) SE Runtime Environment (build 1.6.0\_29-b11-402-11M3527)  
> > > > Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
> > > > 
> > > > Thanks, Jasper

---

<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:** [July 6, 2017, 3:42am UTC](https://discuss.elastic.co/t/homebrew-lion-noclassdeffounderror/6391/6 "2017-07-06T03:42:34Z")

</div>


