# An error occurred while calling z:is.hail.backend.spark.SparkBackend.apply. : java.lang.ExceptionInInitializerError

**URL:** <https://discuss.hail.is/t/an-error-occurred-while-calling-z-is-hail-backend-spark-sparkbackend-apply-java-lang-exceptionininitializererror/3594>\
**Category:** Hail Query & hailctl\
**Created:** [October 4, 2023, 5:57pm UTC](https://discuss.hail.is/t/an-error-occurred-while-calling-z-is-hail-backend-spark-sparkbackend-apply-java-lang-exceptionininitializererror/3594 "2023-10-04T17:57:18Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [October 4, 2023, 8:16pm UTC](https://discuss.hail.is/t/an-error-occurred-while-calling-z-is-hail-backend-spark-sparkbackend-apply-java-lang-exceptionininitializererror/3594/2 "2023-10-04T20:16:07Z")

</div>

Hey @ldomenech !

Can you post the complete stack trace and any other output? I need all that info to be certain what is wrong.

In the meantime, you should try using Java 8 or Java 11. I’m not certain Hail will work with Java 21. We have some links about install java [here](https://hail.is/docs/0.2/install/macosx.html). If you’re using a Mac, you can check these instructions for changing the version of Java once you’ve installed an older version:

> [@On Mac OS X, how do I install and use Java 8 if I already have a different version of Java installed?](https://discuss.hail.is/t/on-mac-os-x-how-do-i-install-and-use-java-8-if-i-already-have-a-different-version-of-java-installed/831):
>
> I have Mac OS X. But I already installed Java 10! How can I install Java 8 and make hail work? This is the error message I’m getting! py4j.protocol.Py4JJavaError: An error occurred while calling z:is.hail.HailContext.apply. : is.hail.utils.HailException: Hail requires Java 8, found 10.0.1 at is.hail.utils.ErrorHandling$class.fatal(ErrorHandling.scala:9) at is.hail.utils.package$.fatal(package.scala:26) at is.hail.HailContext$.apply(HailContext.scala:221) at is.hail.HailContext.apply(HailCo…

---

_[View the full topic](https://discuss.hail.is/t/an-error-occurred-while-calling-z-is-hail-backend-spark-sparkbackend-apply-java-lang-exceptionininitializererror/3594)._
