# Cannot import Java class

**URL:** <https://discuss.elastic.co/t/cannot-import-java-class/155649>\
**Category:** Elasticsearch\
**Created:** [November 7, 2018, 2:14am UTC](https://discuss.elastic.co/t/cannot-import-java-class/155649 "2018-11-07T02:14:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wa\_Tse](https://avatars.discourse-cdn.com/v4/letter/w/d07c76/32.png) [@Wa\_Tse](https://discuss.elastic.co/u/Wa_Tse)\
**Post date:** [November 7, 2018, 2:14am UTC](https://discuss.elastic.co/t/cannot-import-java-class/155649/1 "2018-11-07T02:14:22Z")

</div>

When I try to test to connect to ElasticSearch using Java API, I cannot import the Java class.  
Then I try to use decomplier to check on the class file and exception is shown.  
I find the same problem in window zip and linux zip.  
Please advise if there is anything wrong.

 ![es1](https://us1.discourse-cdn.com/elastic/original/3X/5/8/585578461542f542961b3b2cd613df35925e3ea8.png) ![es2](https://us1.discourse-cdn.com/elastic/original/3X/3/d/3dc4665b2518ea5fcf48a825ddbbb7a0c405bf4a.png) ![es3](https://us1.discourse-cdn.com/elastic/original/3X/9/9/9903d16251aee956a7159a69e9fdf90d614c5798.png)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 7, 2018, 3:21am UTC](https://discuss.elastic.co/t/cannot-import-java-class/155649/2 "2018-11-07T03:21:25Z")

</div>

Just add elasticsearch dependency with maven

---

<div class="post-metadata">

**Author:** ![Wa\_Tse](https://avatars.discourse-cdn.com/v4/letter/w/d07c76/32.png) [@Wa\_Tse](https://discuss.elastic.co/u/Wa_Tse)\
**Post date:** [November 7, 2018, 3:25am UTC](https://discuss.elastic.co/t/cannot-import-java-class/155649/3 "2018-11-07T03:25:53Z")

</div>

Is it a must to use elasticsearch with maven?  
I have already download all related jar and try to do without maven.  
But it seems odd that I cannot open the class in decomplier.  
If there is dependency issue, shouldn't the message like 'Class Not found' instead of 'Invalid Input File' show?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 7, 2018, 6:29am UTC](https://discuss.elastic.co/t/cannot-import-java-class/155649/4 "2018-11-07T06:29:54Z")

</div>

It's much easier to use a dependency manager than trying to download every single jar.

Coming back to your problem I don't know. It's more an IDE issue than anything related to elasticsearch. What I'm doing with my IDE is to ask to download sources as well.

---

<div class="post-metadata">

**Author:** ![Wa\_Tse](https://avatars.discourse-cdn.com/v4/letter/w/d07c76/32.png) [@Wa\_Tse](https://discuss.elastic.co/u/Wa_Tse)\
**Post date:** [November 7, 2018, 9:08am UTC](https://discuss.elastic.co/t/cannot-import-java-class/155649/5 "2018-11-07T09:08:16Z")

</div>

Thanks David.  
I try to use another IDE and I can finally see the missing java class in import.  
But there are still some problem.

1. There are still some java class missing.
2. While I can import the class now, the IDE still cannot detect the method in the class.  
There are obvious issues related to the IDE, so I would like to know if you can share your environment setting (e.g. JDK version, IDE version, etc.).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 7, 2018, 9:42am UTC](https://discuss.elastic.co/t/cannot-import-java-class/155649/6 "2018-11-07T09:42:23Z")

</div>

I'm using IntelliJ but others are using Eclipse.  
+maven  
+java \>= 8 (10 at this moment)

---

<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:** [December 5, 2018, 9:42am UTC](https://discuss.elastic.co/t/cannot-import-java-class/155649/7 "2018-12-05T09:42:25Z")

</div>

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