# Running binary of elasticsearch source code after building

**URL:** <https://discuss.elastic.co/t/running-binary-of-elasticsearch-source-code-after-building/7200>\
**Category:** Elasticsearch\
**Created:** [April 2, 2012, 1:17pm UTC](https://discuss.elastic.co/t/running-binary-of-elasticsearch-source-code-after-building/7200 "2012-04-02T13:17:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BARNEY](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@BARNEY](https://discuss.elastic.co/u/BARNEY)\
**Post date:** [April 2, 2012, 1:17pm UTC](https://discuss.elastic.co/t/running-binary-of-elasticsearch-source-code-after-building/7200/1 "2012-04-02T13:17:33Z")

</div>

Hi,

I made very few changes in elasticsearch source code and I would like  
to run a binary(./elasticsearch -f) of it by command line in  
linux(ubuntu) after building it in intellij IDE.

getting error like this:  
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:217)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)  
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)  
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)  
Could not find the main class:  
org.elasticsearch.bootstrap.ElasticSearch. Program will exit.

Please give me the solution.

Thanks,  
Kalyan

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 2, 2012, 2:09pm UTC](https://discuss.elastic.co/t/running-binary-of-elasticsearch-source-code-after-building/7200/2 "2012-04-02T14:09:37Z")

</div>

The simplest way to do it is by running elasticsearch directly from  
IntelliJ. Create new run configuration by clicking Run-\>Edit  
Configurations-\>"+"-\>Application.  
Select org.elasticsearch.bootstrap.Bootstrap as a main class and paste the  
following VM option:

-Des.foreground=yes

Alternatively, you can run it from command line using the following command  
in the elasticsearch root directory:

$ ES\_CLASSPATH="target/classes:target/lib/\*" bin/elasticsearch -f

You just need to make sure that all dependencies are assembled in the  
target/lib directory by running

$ mvn prepare-package -DskipTests

On Monday, April 2, 2012 9:17:33 AM UTC-4, BARNEY wrote:

> Hi,
> 
> I made very few changes in elasticsearch source code and I would like  
> to run a binary(./elasticsearch -f) of it by command line in  
> linux(ubuntu) after building it in intellij IDE.
> 
> getting error like this:  
> 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:217)  
> at java.security.AccessController.doPrivileged(Native Method)  
> at java.net.URLClassLoader.findClass(URLClassLoader.java:205)  
> at java.lang.ClassLoader.loadClass(ClassLoader.java:321)  
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)  
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)  
> Could not find the main class:  
> org.elasticsearch.bootstrap.Elasticsearch. Program will exit.
> 
> Please give me the solution.
> 
> Thanks,  
> Kalyan

---

<div class="post-metadata">

**Author:** ![BARNEY](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@BARNEY](https://discuss.elastic.co/u/BARNEY)\
**Post date:** [April 3, 2012, 4:54am UTC](https://discuss.elastic.co/t/running-binary-of-elasticsearch-source-code-after-building/7200/3 "2012-04-03T04:54:43Z")

</div>

It is running fine in IntelliJ before I created new run configuration by  
clicking Run-\>Edit Configurations-\>"+"-\>Application.  
Select org.elasticsearch.bootstrap.Bootstrap as a main class and paste the  
following VM option:

> -Des.foreground=yes

but after doing as u said its giving message like below and not running:::

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in  
[jar:file:/home/avinash/.gradle/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in  
[jar:file:/home/avinash/.gradle/cache/org.apache.tika/tika-app/bundles/tika-app-0.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in  
[jar:file:/home/avinash/esearch/elasticsearchsource/git-elasticsearch/elasticsearch/plugins/mapper-attachments/tika-app-0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See [SLF4J Error Codes](http://www.slf4j.org/codes.html#multiple_bindings) for an  
explanation.

Still I am not able to run it from command line.

On Mon, Apr 2, 2012 at 7:39 PM, Igor Motov [imotov@gmail.com](mailto:imotov@gmail.com) wrote:

> The simplest way to do it is by running elasticsearch directly from  
> IntelliJ. Create new run configuration by clicking Run-\>Edit  
> Configurations-\>"+"-\>Application.  
> Select org.elasticsearch.bootstrap.Bootstrap as a main class and paste the  
> following VM option:
> 
> -Des.foreground=yes
> 
> Alternatively, you can run it from command line using the following  
> command in the elasticsearch root directory:
> 
> $ ES\_CLASSPATH="target/classes:target/lib/\*" bin/elasticsearch -f
> 
> You just need to make sure that all dependencies are assembled in the  
> target/lib directory by running
> 
> $ mvn prepare-package -DskipTests
> 
> On Monday, April 2, 2012 9:17:33 AM UTC-4, BARNEY wrote:
> 
> > Hi,
> > 
> > I made very few changes in elasticsearch source code and I would like  
> > to run a binary(./elasticsearch -f) of it by command line in  
> > linux(ubuntu) after building it in intellij IDE.
> > 
> > getting error like this:  
> > 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:217)  
> > at java.security.\*\*AccessController.doPrivileged(\*\*Native  
> > Method)  
> > at java.net.URLClassLoader.\*\*findClass(URLClassLoader.java:\*\*205)
> > 
> > ```
> > at java.lang.ClassLoader.**loadClass(ClassLoader.java:**321)
> > at sun.misc.Launcher$**AppClassLoader.loadClass(**Launcher.java:294)
> > 
> > at java.lang.ClassLoader.**loadClass(ClassLoader.java:**266)
> > 
> > ```
> > 
> > Could not find the main class:  
> > org.elasticsearch.bootstrap.\*\*Elasticsearch. Program will exit.
> > 
> > Please give me the solution.
> > 
> > Thanks,  
> > Kalyan

---

<div class="post-metadata">

**Author:** ![BARNEY](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@BARNEY](https://discuss.elastic.co/u/BARNEY)\
**Post date:** [April 3, 2012, 11:40am UTC](https://discuss.elastic.co/t/running-binary-of-elasticsearch-source-code-after-building/7200/4 "2012-04-03T11:40:52Z")

</div>

I found the way.I created jar from it and put it in lib directory of  
elasticsearch(any version).

On Tue, Apr 3, 2012 at 10:24 AM, kalyan chowdary [kalyanc007@gmail.com](mailto:kalyanc007@gmail.com)wrote:

> It is running fine in IntelliJ before I created new run configuration by  
> clicking Run-\>Edit Configurations-\>"+"-\>Application.  
> Select org.elasticsearch.bootstrap.Bootstrap as a main class and paste the  
> following VM option:
> 
> > -Des.foreground=yes
> 
> but after doing as u said its giving message like below and not running:::
> 
> SLF4J: Class path contains multiple SLF4J bindings.
> 
> SLF4J: Found binding in  
> [jar:file:/home/avinash/.gradle/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> 
> SLF4J: Found binding in  
> [jar:file:/home/avinash/.gradle/cache/org.apache.tika/tika-app/bundles/tika-app-0.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> 
> SLF4J: Found binding in  
> [jar:file:/home/avinash/esearch/elasticsearchsource/git-elasticsearch/elasticsearch/plugins/mapper-attachments/tika-app-0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> 
> SLF4J: See [SLF4J Error Codes](http://www.slf4j.org/codes.html#multiple_bindings) for an  
> explanation.
> 
> Still I am not able to run it from command line.
> 
> On Mon, Apr 2, 2012 at 7:39 PM, Igor Motov [imotov@gmail.com](mailto:imotov@gmail.com) wrote:
> 
> > The simplest way to do it is by running elasticsearch directly from  
> > IntelliJ. Create new run configuration by clicking Run-\>Edit  
> > Configurations-\>"+"-\>Application.  
> > Select org.elasticsearch.bootstrap.Bootstrap as a main class and paste the  
> > following VM option:
> > 
> > -Des.foreground=yes
> > 
> > Alternatively, you can run it from command line using the following  
> > command in the elasticsearch root directory:
> > 
> > $ ES\_CLASSPATH="target/classes:target/lib/\*" bin/elasticsearch -f
> > 
> > You just need to make sure that all dependencies are assembled in the  
> > target/lib directory by running
> > 
> > $ mvn prepare-package -DskipTests
> > 
> > On Monday, April 2, 2012 9:17:33 AM UTC-4, BARNEY wrote:
> > 
> > > Hi,
> > > 
> > > I made very few changes in elasticsearch source code and I would like  
> > > to run a binary(./elasticsearch -f) of it by command line in  
> > > linux(ubuntu) after building it in intellij IDE.
> > > 
> > > getting error like this:  
> > > 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:217)  
> > > at java.security.\*\*AccessController.doPrivileged(\*\*Native  
> > > Method)  
> > > at java.net.URLClassLoader.\*\*findClass(URLClassLoader.java:\*\*205)
> > > 
> > > ```
> > > at java.lang.ClassLoader.**loadClass(ClassLoader.java:**321)
> > > at sun.misc.Launcher$**AppClassLoader.loadClass(**Launcher.java:294)
> > > 
> > > at java.lang.ClassLoader.**loadClass(ClassLoader.java:**266)
> > > 
> > > ```
> > > 
> > > Could not find the main class:  
> > > org.elasticsearch.bootstrap.\*\*Elasticsearch. Program will exit.
> > > 
> > > Please give me the solution.
> > > 
> > > Thanks,  
> > > Kalyan

---

<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:33am UTC](https://discuss.elastic.co/t/running-binary-of-elasticsearch-source-code-after-building/7200/5 "2017-07-06T03:33:55Z")

</div>


