# Running Elasticsearch client with JDK 1.5?

**URL:** <https://discuss.elastic.co/t/running-elasticsearch-client-with-jdk-1-5/5623>\
**Category:** Elasticsearch\
**Created:** [October 18, 2011, 11:35am UTC](https://discuss.elastic.co/t/running-elasticsearch-client-with-jdk-1-5/5623 "2011-10-18T11:35:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Peuss](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@Thomas\_Peuss](https://discuss.elastic.co/u/Thomas_Peuss)\
**Post date:** [October 18, 2011, 11:35am UTC](https://discuss.elastic.co/t/running-elasticsearch-client-with-jdk-1-5/5623/1 "2011-10-18T11:35:06Z")

</div>

Hi!

We want to run an Elasticsearch Java Client (TransportClient) inside a  
1.5 JVM. Unfortunately we have no control about the JVM version.

I have recompiled Elasticsearch for JDK 1.5. That worked without a  
problem. BUT: Elasticsearch packages some third-party libs that seem  
to be compiled with JDK 1.6. Is there a trick to get it running?  
Falling back to HTTP REST is an option. But then I have to code all  
the failover/retry/discovery stuff myself. I want to avoid that.

Greetings  
Thomas

---

<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:** [October 18, 2011, 4:26pm UTC](https://discuss.elastic.co/t/running-elasticsearch-client-with-jdk-1-5/5623/2 "2011-10-18T16:26:52Z")

</div>

Not really..., some libs are 1.6 so it will cause problems. I think the main  
one is the jsr166 libs, that potentially can be complied with 1.5, but never  
tried to.

On Tue, Oct 18, 2011 at 1:35 PM, Thomas Peuss [thomas.peuss@nterra.com](mailto:thomas.peuss@nterra.com)wrote:

> Hi!
> 
> We want to run an Elasticsearch Java Client (TransportClient) inside a  
> 1.5 JVM. Unfortunately we have no control about the JVM version.
> 
> I have recompiled Elasticsearch for JDK 1.5. That worked without a  
> problem. BUT: Elasticsearch packages some third-party libs that seem  
> to be compiled with JDK 1.6. Is there a trick to get it running?  
> Falling back to HTTP REST is an option. But then I have to code all  
> the failover/retry/discovery stuff myself. I want to avoid that.
> 
> Greetings  
> Thomas

---

<div class="post-metadata">

**Author:** ![antonio\_fernandez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antonio_fernandez/32/3083_2.png) [@antonio\_fernandez](https://discuss.elastic.co/u/antonio_fernandez)\
**Post date:** [November 10, 2011, 12:37am UTC](https://discuss.elastic.co/t/running-elasticsearch-client-with-jdk-1-5/5623/3 "2011-11-10T00:37:00Z")

</div>

Hi all,

I´m in a situation very similar to Thomas , our client does not allow  
upgrading to JDK 6.

@thomas : Could you help me to get ES compiled for JDK 1.5 ? What did  
you do ? Thanks in advance

Without a solid knowledge about Gradle I tried modifying build.gradle  
file :

```
plugins.withType(JavaPlugin).whenPluginAdded {
    sourceCompatibility = 1.5
    targetCompatibility = 1.5
    compileJava {
        sourceCompatibility = 1.5
        targetCompatibility = 1.5
        options.encoding = "UTF8"
    }

```

Compile process displays warnings but ends, and then when I run the  
client I get the following exception :

Caused by: java.lang.UnsupportedClassVersionError: (org/elasticsearch/  
common/util/concurrent/jsr166y/ThreadLocalRandom) bad major version at  
offset=6

I think it would be interesting ES were compatible with JVM 1.5, but I  
understand that other issues & features have more priority or  
interest 🙂

Greetings & Have a nice day,

On 18 oct, 17:26, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Not really..., some libs are 1.6 so it will cause problems. I think the main  
> one is the jsr166 libs, that potentially can be complied with 1.5, but never  
> tried to.
> 
> On Tue, Oct 18, 2011 at 1:35 PM, Thomas Peuss [thomas.pe...@nterra.com](mailto:thomas.pe...@nterra.com)wrote:
> 
> > Hi!
> 
> > We want to run an Elasticsearch Java Client (TransportClient) inside a  
> > 1.5 JVM. Unfortunately we have no control about the JVM version.
> 
> > I have recompiled Elasticsearch for JDK 1.5. That worked without a  
> > problem. BUT: Elasticsearch packages some third-party libs that seem  
> > to be compiled with JDK 1.6. Is there a trick to get it running?  
> > Falling back to HTTP REST is an option. But then I have to code all  
> > the failover/retry/discovery stuff myself. I want to avoid that.
> 
> > Greetings  
> > Thomas- Ocultar texto de la cita -
> 
> - Mostrar texto de la cita -

---

<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:49am UTC](https://discuss.elastic.co/t/running-elasticsearch-client-with-jdk-1-5/5623/4 "2017-07-06T03:49:14Z")

</div>


