# Error: Could not find or load main class org.elasticsearch.bootstrap.Elasticsearch

**URL:** <https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826>\
**Category:** Elasticsearch\
**Created:** [March 27, 2018, 9:14pm UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826 "2018-03-27T21:14:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![breakAwall](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@breakAwall](https://discuss.elastic.co/u/breakAwall)\
**Post date:** [March 27, 2018, 9:14pm UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/1 "2018-03-27T21:14:05Z")

</div>

I ran the command bin/elasticsearch command and got the error  
Error: Could not find or load main class org.elasticsearch.bootstrap.Elasticsearch  
As per previous threads I ensured that my java Home variable was set correctly and even put a direct link to jdk 1.8.0\_151 in my path variable. Nevertheless I continue to have this issue. I would appreciate any advice on how to fix it.

Thanks.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [March 28, 2018, 12:21am UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/2 "2018-03-28T00:21:10Z")

</div>

Hi, I am sorry that you are having trouble. Issues like this are usually environment issues (e.g., permissions issues). Let us see if we can work through this one together.

Let us start by running from the root of the Elasticsearch installation directory:

```auto
$ bash -x ./bin/elasticsearch

```

By the way, what version is this? How did you install Elasticsearch (from an archive like `tar.gz`, or using a package manager like `yum`)? What user are you running Elasticsearch as? Could you also do (again from the root of the Elasticsearch installation directory):

```auto
$ ls -al ./lib

```

---

<div class="post-metadata">

**Author:** ![breakAwall](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@breakAwall](https://discuss.elastic.co/u/breakAwall)\
**Post date:** [March 28, 2018, 1:30am UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/3 "2018-03-28T01:30:56Z")

</div>

Hi!

I downloaded the 2.4.1 version of elastic search from [https://www.elastic.co/downloads/past-releases/elasticsearch-2-4-1](https://www.elastic.co/downloads/past-releases/elasticsearch-2-4-1). I downloaded a zipped file and unzipped it simply using command line. I am running elastic search from the root user of my computer but I run the command through bash. I am on a windows 10 64-bit system otherwise. And upon running the recommended command I get the following output.

total 24892  
drwxr-xr-x 1 kgoel 197609 0 Mar 27 16:01 ./  
drwxr-xr-x 1 kgoel 197609 0 Mar 27 16:02 ../  
-rw-r--r-- 1 kgoel 197609 448794 Mar 27 16:01 apache-log4j-extras-1.2.17.jar  
-rw-r--r-- 1 kgoel 197609 52988 Mar 27 16:01 commons-cli-1.3.1.jar  
-rw-r--r-- 1 kgoel 197609 110694 Mar 27 16:01 compiler-0.8.13.jar  
-rw-r--r-- 1 kgoel 197609 79732 Mar 27 16:01 compress-lzf-1.0.2.jar  
-rw-r--r-- 1 kgoel 197609 9484320 Mar 27 16:01 elasticsearch-2.4.1.jar  
-rw-r--r-- 1 kgoel 197609 2256213 Mar 27 16:01 guava-18.0.jar  
-rw-r--r-- 1 kgoel 197609 109723 Mar 27 16:01 HdrHistogram-2.1.6.jar  
-rw-r--r-- 1 kgoel 197609 1140290 Mar 27 16:01 hppc-0.7.1.jar  
-rw-r--r-- 1 kgoel 197609 280014 Mar 27 16:01 jackson-core-2.8.1.jar  
-rw-r--r-- 1 kgoel 197609 50196 Mar 27 16:01 jackson-dataformat-cbor-2.8.1.jar  
-rw-r--r-- 1 kgoel 197609 72874 Mar 27 16:01 jackson-dataformat-smile-2.8.1.jar  
-rw-r--r-- 1 kgoel 197609 40540 Mar 27 16:01 jackson-dataformat-yaml-2.8.1.jar  
-rw-r--r-- 1 kgoel 197609 914597 Mar 27 16:01 jna-4.1.0.jar  
-rw-r--r-- 1 kgoel 197609 38460 Mar 27 16:01 joda-convert-1.2.jar  
-rw-r--r-- 1 kgoel 197609 629506 Mar 27 16:01 joda-time-2.9.4.jar  
-rw-r--r-- 1 kgoel 197609 62226 Mar 27 16:01 jsr166e-1.1.0.jar  
-rw-r--r-- 1 kgoel 197609 794991 Mar 27 16:01 jts-1.13.jar  
-rw-r--r-- 1 kgoel 197609 489884 Mar 27 16:01 log4j-1.2.17.jar  
-rw-r--r-- 1 kgoel 197609 1576592 Mar 27 16:01 lucene-analyzers-common-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 430602 Mar 27 16:01 lucene-backward-codecs-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 2368341 Mar 27 16:01 lucene-core-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 107160 Mar 27 16:01 lucene-grouping-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 144597 Mar 27 16:01 lucene-highlighter-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 136173 Mar 27 16:01 lucene-join-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 33803 Mar 27 16:01 lucene-memory-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 172291 Mar 27 16:01 lucene-misc-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 251401 Mar 27 16:01 lucene-queries-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 402296 Mar 27 16:01 lucene-queryparser-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 232257 Mar 27 16:01 lucene-sandbox-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 197316 Mar 27 16:01 lucene-spatial3d-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 261161 Mar 27 16:01 lucene-spatial-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 246202 Mar 27 16:01 lucene-suggest-5.5.2.jar  
-rw-r--r-- 1 kgoel 197609 1292696 Mar 27 16:01 netty-3.10.6.Final.jar  
-rw-r--r-- 1 kgoel 197609 7024 Mar 27 16:01 securesm-1.0.jar  
-rw-r--r-- 1 kgoel 197609 269295 Mar 27 16:01 snakeyaml-1.15.jar  
-rw-r--r-- 1 kgoel 197609 148571 Mar 27 16:01 spatial4j-0.5.jar  
-rw-r--r-- 1 kgoel 197609 49754 Mar 27 16:01 t-digest-3.0.jar

Thanks for the help!!

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [March 28, 2018, 1:52am UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/4 "2018-03-28T01:52:00Z")

</div>

Thanks for the information. Do you also have the output from the following executed from the installation directory for Elasticsearch:

```auto
$ bash -x ./bin/elasticsearch

```

---

<div class="post-metadata">

**Author:** ![breakAwall](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@breakAwall](https://discuss.elastic.co/u/breakAwall)\
**Post date:** [March 28, 2018, 2:06am UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/5 "2018-03-28T02:06:53Z")

</div>

Hi, Sorry for that. Here is my output for bash -x ./bin/elasticsearch

- IS\_PACKAGED\_VERSION=distributions
- '[' distributions '!=' distributions ']'
- CDPATH=
- SCRIPT=./bin/elasticsearch
- '[' -h ./bin/elasticsearch ']'  
++ dirname ./bin/elasticsearch
- ES\_HOME=./bin/..  
++ cd ./bin/..  
++ pwd
- ES\_HOME=/c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1
- '[' x = x ']'  
++ dirname ./bin/elasticsearch
- for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh ~/.elasticsearch.in.sh "$ES\_HOME/bin/elasticsearch.in.sh" "`dirname "$0"`"/elasticsearch.in.sh
- '[' -r /usr/share/elasticsearch/elasticsearch.in.sh ']'
- for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh ~/.elasticsearch.in.sh "$ES\_HOME/bin/elasticsearch.in.sh" "`dirname "$0"`"/elasticsearch.in.sh
- '[' -r /usr/local/share/elasticsearch/elasticsearch.in.sh ']'
- for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh ~/.elasticsearch.in.sh "$ES\_HOME/bin/elasticsearch.in.sh" "`dirname "$0"`"/elasticsearch.in.sh
- '[' -r /opt/elasticsearch/elasticsearch.in.sh ']'
- for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh ~/.elasticsearch.in.sh "$ES\_HOME/bin/elasticsearch.in.sh" "`dirname "$0"`"/elasticsearch.in.sh
- '[' -r /c/Users/kgoel/.elasticsearch.in.sh ']'
- for include in /usr/share/elasticsearch/elasticsearch.in.sh /usr/local/share/elasticsearch/elasticsearch.in.sh /opt/elasticsearch/elasticsearch.in.sh ~/.elasticsearch.in.sh "$ES\_HOME/bin/elasticsearch.in.sh" "`dirname "$0"`"/elasticsearch.in.sh
- '[' -r /c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1/bin/elasticsearch.in.sh ']'
- . /c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1/bin/elasticsearch.in.sh  
++ '[' x '!=' x ']'  
++ ES\_CLASSPATH='/c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1/lib/elasticsearch-2.4.1.jar:/c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1/lib/\*'  
++ '[' x = x ']'  
++ ES\_MIN\_MEM=256m  
++ '[' x = x ']'  
++ ES\_MAX\_MEM=1g  
++ '[' x '!=' x ']'  
++ JAVA\_OPTS=' -Xms256m'  
++ JAVA\_OPTS=' -Xms256m -Xmx1g'  
++ '[' x '!=' x ']'  
++ '[' x '!=' x ']'  
++ JAVA\_OPTS=' -Xms256m -Xmx1g -Djava.awt.headless=true'  
++ '[' x '!=' x ']'  
++ '[' x = x ']'  
++ ES\_GC\_OPTS=' -XX:+UseParNewGC'  
++ ES\_GC\_OPTS=' -XX:+UseParNewGC -XX:+UseConcMarkSweepGC'  
++ ES\_GC\_OPTS=' -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75'  
++ ES\_GC\_OPTS=' -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly'  
++ JAVA\_OPTS=' -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly'  
++ '[' -n '' ']'  
++ JAVA\_OPTS=' -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError'  
++ JAVA\_OPTS=' -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC'  
++ JAVA\_OPTS=' -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8'  
++ JAVA\_OPTS=' -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true'
- break
- '[' -x 'C:\Program Files\Java\jre1.8.0\_151:C:\Program Files\Java\jdk1.8.0\_151\bin/bin/java' ']'  
++ which java
- JAVA=/c/ProgramData/Oracle/Java/javapath/java
- '[' '!' -x /c/ProgramData/Oracle/Java/javapath/java ']'
- '[' -z '/c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1/lib/elasticsearch-2.4.1.jar:/c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1/lib/\*' ']'
- '[' x '!=' x ']'
- case `uname` in  
++ uname  
++ hostname  
++ cut -d. -f1
- HOSTNAME=DESKTOP-19TLNMK
- export HOSTNAME  
++ echo  
++ egrep -- '(^-d |-d$| -d |--daemonize$|--daemonize )'
- daemonized=
- '[' -z '' ']'
- exec /c/ProgramData/Oracle/Java/javapath/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1 -cp '/c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1/lib/elasticsearch-2.4.1.jar:/c/Users/kgoel/Desktop/aristo-mini/elasticsearch-2.4.1/lib/\*' org.elasticsearch.bootstrap.Elasticsearch start  
Error: Could not find or load main class org.elasticsearch.bootstrap.Elasticsearch

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [March 28, 2018, 2:25am UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/6 "2018-03-28T02:25:14Z")

</div>

Ah, it looks like you're running on `bash` on Windows (or some variant, like Git `bash` on Windows, or Cygwin). I am sorry to say that I do not think that will work. Would you try the batch file from the command prompt (`.\bin\elasticsearch.bat`)?

---

<div class="post-metadata">

**Author:** ![breakAwall](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@breakAwall](https://discuss.elastic.co/u/breakAwall)\
**Post date:** [March 28, 2018, 3:08am UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/7 "2018-03-28T03:08:33Z")

</div>

Hi, thanks for that help!! However when I did try running the batch file in windows I got the following

C:\Users\kgoel\Desktop\aristo-mini\elasticsearch-2.4.1\>.\bin\elasticsearch.bat  
The filename, directory name, or volume label syntax is incorrect.

C:\Users\kgoel\Desktop\aristo-mini\elasticsearch-2.4.1\>.\bin\elasticsearch  
The filename, directory name, or volume label syntax is incorrect.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [April 5, 2018, 11:57am UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/8 "2018-04-05T11:57:07Z")

</div>

That one is puzzling. Let us see if we can figure it out. I suspect it might be some quoting of `JAVA_HOME`, so let us start there. What is the output of `echo %JAVA_HOME%`?

---

<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:** [May 3, 2018, 11:57am UTC](https://discuss.elastic.co/t/error-could-not-find-or-load-main-class-org-elasticsearch-bootstrap-elasticsearch/125826/9 "2018-05-03T11:57:11Z")

</div>

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