# JAVA\_HOME variable

**URL:** <https://discuss.bitrise.io/t/java-home-variable/1492>\
**Category:** Question & Answer\
**Created:** [April 18, 2017, 6:58pm UTC](https://discuss.bitrise.io/t/java-home-variable/1492 "2017-04-18T18:58:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rethink](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@rethink](https://discuss.bitrise.io/u/rethink)\
**Post date:** [April 18, 2017, 6:58pm UTC](https://discuss.bitrise.io/t/java-home-variable/1492/1 "2017-04-18T18:58:24Z")

</div>

I am getting an error while generating Android build because one of libraries we are using try to use JAVA\_HOME variable. The error message indicated that this variable didnt exist in the OS.  
After downloading and executing the docker image we concluded that it is in fact not set.

As we cant change the library source, we tried to add this enviroment variable in the workflow but unsuccessfully.

Is there anyway I can set this Enviroment Variable by the workflow?

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [April 18, 2017, 7:02pm UTC](https://discuss.bitrise.io/t/java-home-variable/1492/2 "2017-04-18T19:02:27Z")

</div>

> [@rethink](#):
>
> we tried to add this enviroment variable in the workflow but unsuccessfully.

How did you try to add it?

> [@rethink](#):
>
> Is there anyway I can set this Enviroment Variable by the workflow?

Adding it as an **App Env Var** should work - those are set as global environment variables (applied/exposed for every Workflow / every build).

---

<div class="post-metadata">

**Author:** ![rethink](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@rethink](https://discuss.bitrise.io/u/rethink)\
**Post date:** [April 18, 2017, 8:31pm UTC](https://discuss.bitrise.io/t/java-home-variable/1492/3 "2017-04-18T20:31:05Z")

</div>

Many thanks Viktor, it did work. I was adding variable using “Manage env. vars” button.

I am getting another error now but it is unrelated with that. I will work on that.

Thank you.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [April 19, 2017, 3:42pm UTC](https://discuss.bitrise.io/t/java-home-variable/1492/4 "2017-04-19T15:42:33Z")

</div>

I’m glad to hear it worked 😉

Just one note: Manage env vars should also work if that step is in that workflow.

The UI is not clear, will be fixed in the upcoming new Workflow Editor ([Workflow Editor “v2” (Open Source & Offline Workflow Editor)](http://discuss.bitrise.io/t/offline-workflow-editor-workflow-editor-v2/39)). Manage Env Vars right now sets env vars for only the selected workflow. Those env vars won’t be available in other workflows (unless chained as an after workflow), App Env Vars are exposed for all workflows (related docs: [http://devcenter.bitrise.io/bitrise-cli/most-important-concepts/#availability-order-of-environment-variables](http://devcenter.bitrise.io/bitrise-cli/most-important-concepts/#availability-order-of-environment-variables)).
