# Java no class def found error while installing elasticsearch?

**URL:** <https://discuss.elastic.co/t/java-no-class-def-found-error-while-installing-elasticsearch/6260>\
**Category:** Elasticsearch\
**Created:** [December 31, 2011, 2:15am UTC](https://discuss.elastic.co/t/java-no-class-def-found-error-while-installing-elasticsearch/6260 "2011-12-31T02:15:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Jiang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_jiang/32/3032_2.png) [@Jason\_Jiang](https://discuss.elastic.co/u/Jason_Jiang)\
**Post date:** [December 31, 2011, 2:15am UTC](https://discuss.elastic.co/t/java-no-class-def-found-error-while-installing-elasticsearch/6260/1 "2011-12-31T02:15:18Z")

</div>

I followed these steps on [https://github.com/karmi/tire](https://github.com/karmi/tire) to install  
elasticsearch

curl -k -L -o elasticsearch-0.17.6.tar.gz  
[http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz](http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz)

tar -zxvf elasticsearch-0.17.6.tar.gz

./elasticsearch-0.17.6/bin/elasticsearch -f

I am running this on MinGW on windows 7, and most of the process went  
smoothly.

However, as I try to start the server with ./elasticsearch-0.17.6/bin/  
elasticsearch -f I get a java no class def found error:

$ ./elasticsearch-0.17.6/bin/elasticsearch  
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(Unknown Source)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.net.URLClassLoader.findClass(Unknown Source)  
at java.lang.ClassLoader.loadClass(Unknown Source)  
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)  
at java.lang.ClassLoader.loadClass(Unknown Source)  
Could not find the main class:  
org.elasticsearch.bootstrap.ElasticSearch. Program will exit.

What gives?

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 31, 2011, 5:39am UTC](https://discuss.elastic.co/t/java-no-class-def-found-error-while-installing-elasticsearch/6260/2 "2011-12-31T05:39:59Z")

</div>

I am not familiar with the Ruby/Tire client, but if it is working via  
HTTP, there should be no reason why you would not be able to work with  
the latest ES version (0.18.6). Try installing the latest version and  
see if you get the same error.

[https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.6.tar.gz](https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.6.tar.gz)

Also, I am not sure if the -f flag works on Windows, but it still  
would not be the cause of NoClassDefFoundError.

--  
Ivan

On Fri, Dec 30, 2011 at 6:15 PM, Jason Jiang  
[petrifiednightmares@gmail.com](mailto:petrifiednightmares@gmail.com) wrote:

> I followed these steps on [GitHub - karmi/retire: A rich Ruby API and DSL for the Elasticsearch search engine](https://github.com/karmi/tire) to install  
> elasticsearch
> 
> curl -k -L -o elasticsearch-0.17.6.tar.gz  
> [http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz](http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz)
> 
> tar -zxvf elasticsearch-0.17.6.tar.gz
> 
> ./elasticsearch-0.17.6/bin/elasticsearch -f
> 
> I am running this on MinGW on windows 7, and most of the process went  
> smoothly.
> 
> However, as I try to start the server with ./elasticsearch-0.17.6/bin/  
> elasticsearch -f I get a java no class def found error:
> 
> $ ./elasticsearch-0.17.6/bin/elasticsearch  
> 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(Unknown Source)  
> at java.security.AccessController.doPrivileged(Native Method)  
> at java.net.URLClassLoader.findClass(Unknown Source)  
> at java.lang.ClassLoader.loadClass(Unknown Source)  
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)  
> at java.lang.ClassLoader.loadClass(Unknown Source)  
> Could not find the main class:  
> org.elasticsearch.bootstrap.Elasticsearch. Program will exit.
> 
> What gives?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 31, 2011, 10:47am UTC](https://discuss.elastic.co/t/java-no-class-def-found-error-while-installing-elasticsearch/6260/3 "2011-12-31T10:47:14Z")

</div>

It might be a problem wiht MinGW and installing elasticsearch in a path  
with spaces. Frist, try and see if you still get it with the latest  
elasticsearch (0.18.6). If it still happens, they some path variables  
should probably be quoted (which one does MinGW calls, the  
elasticsearch.bat one or the elasticsearch one?).

On Sat, Dec 31, 2011 at 4:15 AM, Jason Jiang  
[petrifiednightmares@gmail.com](mailto:petrifiednightmares@gmail.com)wrote:

> I followed these steps on [GitHub - karmi/retire: A rich Ruby API and DSL for the Elasticsearch search engine](https://github.com/karmi/tire) to install  
> elasticsearch
> 
> curl -k -L -o elasticsearch-0.17.6.tar.gz
> 
> [http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz](http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz)
> 
> tar -zxvf elasticsearch-0.17.6.tar.gz
> 
> ./elasticsearch-0.17.6/bin/elasticsearch -f
> 
> I am running this on MinGW on windows 7, and most of the process went  
> smoothly.
> 
> However, as I try to start the server with ./elasticsearch-0.17.6/bin/  
> elasticsearch -f I get a java no class def found error:
> 
> $ ./elasticsearch-0.17.6/bin/elasticsearch  
> 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(Unknown Source)  
> at java.security.AccessController.doPrivileged(Native Method)  
> at java.net.URLClassLoader.findClass(Unknown Source)  
> at java.lang.ClassLoader.loadClass(Unknown Source)  
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)  
> at java.lang.ClassLoader.loadClass(Unknown Source)  
> Could not find the main class:  
> org.elasticsearch.bootstrap.Elasticsearch. Program will exit.
> 
> What gives?

---

<div class="post-metadata">

**Author:** ![Jason\_Jiang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jason_jiang/32/3032_2.png) [@Jason\_Jiang](https://discuss.elastic.co/u/Jason_Jiang)\
**Post date:** [December 31, 2011, 10:56pm UTC](https://discuss.elastic.co/t/java-no-class-def-found-error-while-installing-elasticsearch/6260/4 "2011-12-31T22:56:40Z")

</div>

Yeah It did turn out to be a MinGW problem. I had to use windows style  
paths instead of unix style paths for classpath and it is working now.

Thanks guys

On Dec 31, 2:47 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> It might be a problem wiht MinGW and installing elasticsearch in a path  
> with spaces. Frist, try and see if you still get it with the latest  
> elasticsearch (0.18.6). If it still happens, they some path variables  
> should probably be quoted (which one does MinGW calls, the  
> elasticsearch.bat one or the elasticsearch one?).
> 
> On Sat, Dec 31, 2011 at 4:15 AM, Jason Jiang  
> [petrifiednightma...@gmail.com](mailto:petrifiednightma...@gmail.com)wrote:
> 
> > I followed these steps onhttps://github.com/karmi/tireto install  
> > elasticsearch
> 
> > curl -k -L -o elasticsearch-0.17.6.tar.gz
> 
> > [http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch](http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch)...
> 
> > tar -zxvf elasticsearch-0.17.6.tar.gz
> 
> > ./elasticsearch-0.17.6/bin/elasticsearch -f
> 
> > I am running this on MinGW on windows 7, and most of the process went  
> > smoothly.
> 
> > However, as I try to start the server with ./elasticsearch-0.17.6/bin/  
> > elasticsearch -f I get a java no class def found error:
> 
> > $ ./elasticsearch-0.17.6/bin/elasticsearch  
> > 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(Unknown Source)  
> > at java.security.AccessController.doPrivileged(Native Method)  
> > at java.net.URLClassLoader.findClass(Unknown Source)  
> > at java.lang.ClassLoader.loadClass(Unknown Source)  
> > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)  
> > at java.lang.ClassLoader.loadClass(Unknown Source)  
> > Could not find the main class:  
> > org.elasticsearch.bootstrap.Elasticsearch. Program will exit.
> 
> > What gives?

---

<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:44am UTC](https://discuss.elastic.co/t/java-no-class-def-found-error-while-installing-elasticsearch/6260/5 "2017-07-06T03:44:04Z")

</div>


