Appium Doctor - unable to set JAVA_HOME/bin

Hi everyone,

Installed appium doctor with npm on MacOS 10.12, and it gives me one error:
WARN AppiumDoctor ✖ Bin directory for $JAVA_HOME is not set.

I’ve tried everything I could so far, please help.
Here is my .bash_profile:

export ANDROID_HOME="/Users/sergei/Library/Android/sdk/"
export PATH=$ANDROID_HOME/platform-tools:$PATH
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/H$
export PATH=$JAVA_HOME/bin:$PATH
export M2_HOME="/Users/sergei/Desktop/1246702 Sergio/apache-maven-3.3.9"
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export JYTHON_HOME="/Users/sergei/jython2.7.0/"

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
1 Like

You can try setting the .bashrc profile as well and you can try to set JAVA_HOME variable like this : export JAVA_HOME=$(/usr/libexec/java_home)

export PATH=${JAVA_HOME}/bin:$PATH

1 Like

Thank you, I’ve already solved it.

I’ve tried setting .bashrc as well to no avail, but then I found the error was with the slash “/” symbol

Can you please give the full line you used to resolve the issue … What slash “/” symbol did you fix .

1 Like

The slashes at the end of HOME locations (line 1, 4, and 9)
Because you first export HOME location with the slash at the end, i.e.
export ANDROID_HOME="/Android/sdk/"

then you export the path with the slash before the necessary folder, i.e.
export PATH=$ANDROID_HOME/platform-tools:$PATH

so the PATH will be recognized as “/Android/sdk//platform-tools” (double slash after sdk). This was the root of my problems with setting the path. At least I think it was.

If you are facing the same issues as I am and can not solve it, then I can send you the whole variables that are working which I have set at the moment, but only tomorrow when I get to work.

export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$PATH:$JAVA_HOME/bin


@crujzo - I kept getting an error of “Bin directory for $JAVA_HOME is not set” from Appium doctor. Adding export JAVA_HOME=$(/usr/libexec/java_home) and export PATH=${JAVA_HOME}/bin:$PATH seems to have fixed the issue. Thanks!


Open bash profile using Nano editor

type below command

nano .bash_profile and edit the file

export PATH=$PATH:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin

make sure about jdk version which you are targeting

If somebody come to this post looking for solution on Windows OS please follow

On side note, I will recommend to use Mac OS for appium related automation; it’s best suited for mobile automation and will surely give much less headaches :wink:


1 Like

Thanks @ chiwhitesox56 . It works for me.

Hi beginner in the field of Appium .Need help to set in mac os
In my bash profile

export PATH=/usr/local/Cellar/maven/3.6.2/bin:$PATH

export PATH=/usr/local/mysql/bin:$PATH

export JAVA_HOME=$(/usr/libexec/java_home)

export PATH=${JAVA_HOME}/bin:$PATH

export ANDRIOD_HOME=/Users/xxxxxxxxx/Library/Andriod/sdk

export PATH=$ANDRIOD_HOME/emulator:$ANDRIOD_HOME/tools:$ANDRIOD_HOME/tools/bin:$ANDRIOD_HOME/platform-tools:$PATH

Still Appium doctor not able to detect.Please any one can help , I would be great help!!