# JarHell ERROR: Classpath should not contain empty elements!

**URL:** <https://discuss.elastic.co/t/jarhell-error-classpath-should-not-contain-empty-elements/35810>\
**Category:** Elasticsearch\
**Created:** [November 28, 2015, 7:22pm UTC](https://discuss.elastic.co/t/jarhell-error-classpath-should-not-contain-empty-elements/35810 "2015-11-28T19:22:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Isra](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Isra](https://discuss.elastic.co/u/Isra)\
**Post date:** [November 28, 2015, 7:22pm UTC](https://discuss.elastic.co/t/jarhell-error-classpath-should-not-contain-empty-elements/35810/1 "2015-11-28T19:22:16Z")

</div>

I created a java file using Elasticsearch JAVA API. in netbeans, everything worked just fine.

However, I started getting the following error:

```
org/elasticsearch/plugins/PluginsService.java:342:in `loadBundles': java.lang.IllegalStateException: failed to load bundle [file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-core-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-plugin-api-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/marvel-agent/marvel-agent-2.0.0.jar] due to jar hell
from org/elasticsearch/plugins/PluginsService.java:113:in `<init>'
from org/elasticsearch/node/Node.java:144:in `<init>'
from org/elasticsearch/node/NodeBuilder.java:145:in `build'
from spamdetection/SpamDetection.java:63:in `client'
from spamdetection/SpamDetection.java:30:in `SpammerDetector'
from java/lang/reflect/Method.java:497:in `invoke'
from spam.rb:53:in `(root)'
from spam.rb:53:in `(root)'
Caused by:
JarHell.java:120:in `parseClassPath': java.lang.IllegalStateException: Classpath should not contain empty elements! (outdated shell script from a previous version?) classpath=''
from JarHell.java:95:in `parseClassPath'
from PluginsService.java:338:in `loadBundles'
from PluginsService.java:113:in `<init>'
from Node.java:144:in `<init>'
from NodeBuilder.java:145:in `build'
from SpamDetection.java:63:in `client'
from SpamDetection.java:30:in `SpammerDetector'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:62:in `invoke'
from DelegatingMethodAccessorImpl.java:43:in `invoke'
from Method.java:497:in `invoke'
from JavaMethod.java:451:in `invokeDirectWithExceptionHandling'
from JavaMethod.java:312:in `invokeDirect'
from InstanceMethodInvoker.java:45:in `call'
from CachingCallSite.java:326:in `cacheAndCall'
from CachingCallSite.java:170:in `call'
from spam.rb:53:in ` __file__'
from spam.rb:-1:in `load'
from Ruby.java:857:in `runScript'
from Ruby.java:850:in `runScript'
from Ruby.java:729:in `runNormally'
from Ruby.java:578:in `runFromMain'
from Main.java:395:in `doRunFromMain'
from Main.java:290:in `internalRun'
from Main.java:217:in `run'
from Main.java:197:in `main'

```

When trying to call my java jar from jruby. Whats causing this error?? How do I get rid of it?

The following is my java code. I've manually included all the jar files needed besides elasticsearch-2.0.0.jar

```
public boolean mymethod(String Username) {

Node node = NodeBuilder.nodeBuilder().client(true).settings(
Settings.builder()
    .put(ClusterName.SETTING, "elasticsearch")
    .put("path.home", "PATH/TO/elasticsearch-2.0.0/")
    ).build().start();
   Client client = node.client();

    QueryBuilder qb = matchQuery(
        "user.screen_name",                  
         Username   
    );

   CountResponse response = client.prepareCount("logstash-*")
    .setTypes("tweet").setQuery(qb)
    .execute()
    .actionGet();

return response.getCount() != 0;
}
....

```

The error rises when I call this code from a Jruby file. Help pelase!!!

Thank you.

---

<div class="post-metadata">

**Author:** ![Isra](https://avatars.discourse-cdn.com/v4/letter/i/7ba0ec/32.png) [@Isra](https://discuss.elastic.co/u/Isra)\
**Post date:** [November 29, 2015, 9:56am UTC](https://discuss.elastic.co/t/jarhell-error-classpath-should-not-contain-empty-elements/35810/2 "2015-11-29T09:56:26Z")

</div>

I noticed that when I move the jruby file to elasticsearch home path, it works just fine... hmmm why is that?

---

<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 5, 2017, 11:35pm UTC](https://discuss.elastic.co/t/jarhell-error-classpath-should-not-contain-empty-elements/35810/3 "2017-07-05T23:35:05Z")

</div>


