JAVA8_HOME not found while running tests


This is my first post, so I apologize if something is not as clear as it should be. I am sure the next ones will be better :slight_smile:

I want to contribute to the project so I forked and cloned the github repo and I managed to assemble the project but when I execute the check task to run the tests the system prints that it is necessary JAVA8_HOME although I have it added to my .bashrc

I tried first with the openjdk-8 and then uninstalling and installing the oracle jdk and I got the same result.

Thanks in advance for your help!

Hi @CroissantBlanc

the problem seems to be that root does not have the JAVA8_HOME environment set and you're running ./gradlew check via sudo. You shouldn't need to run the tests as sudo and fix your environment such that you can run tests as your normal user.
If that's not an option for some reason, you should add JAVA8_HOME to root's environment as well.

Hope that helps.

1 Like

Hi @Armin_Braun

Lots of thanks for your answer, with it I have been able to find the underlying problem.

I explain here just in case someone gets stuck in the same way:

I was running ./gradle check via sudo because the system threw a Permission denied exception when I ran with my user.

Taking a closer look to the permission issue I found that the file owner was root. And that is because this file was generated by ./gradle assemble. That led me to the next question, why running this command with sudo? I ran it with sudo because if not, there was a Permission denied exception when running a docker command.

So that was the original problem, docker command by default is only allowed to su.

The next steps were:

  1. Add my user to docker user group:
    sudo usermod -aG docker $USER
  2. Refresh the user group (via log out - log in or reload user's group switching primary group)

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