Appium Doctor - unable to set $JAVA_HOME/bin into PATH variable on MacOS 10.12

33,740

Solution 1

I removed double quotes from the paths and slashes from the end This is working fine for me now:

export ANDROID_HOME=/Users/sergei/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

Solution 2

I needed to add

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

to ~/.bash_profile and restart the terminal

Solution 3

This looks to be an old post, but for future viewers, I found this solution better due to it doesn't hardcode java sdk path.

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

Solution 4

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

Solution 5

For me After Adding JAVA_HOME and ANDROID_HOME in ~/.bash_profile file as export and in PATH

export ANDROID_HOME=/Library/YourUserName/Library/Android/sdk
export PATH="$PATH:$ANDROID_HOME:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools"

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

in your terminal just type this

source ~/.bash_profile

Still I need to re-start the Appium server then it worked.

But Appium has given the easy feature to save the user time
Open the Appium app and then You can Click on the "Edit Configurations" Button
A dialog/pop window will appear and where you can add two parameter

  • ANDROID_HOME
  • JAVA_HOME

path(same as above) in the editText. then Click on "Save and Restart"
again click on "restart now" button in the pop window and
you are done once Appium is restarted an up and
no need to deal with bash_profile or any command

Share:
33,740
SergioLeone
Author by

SergioLeone

Updated on September 22, 2021

Comments

  • SergioLeone
    SergioLeone over 2 years

    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 PATH=$ANDROID_HOME/tools:$PATH
    export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
    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 JYTHON=JYTHON_HOME/bin
    export PATH=JYTHON:$PATH
    
    export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
    
  • Joshua Pinter
    Joshua Pinter over 6 years
    Make sure that JAVA_HOME doesn't have a trailing slash / on the end of the path, that's what caused an error for me as well.
  • Tu.Ma.
    Tu.Ma. about 4 years
    Welcome to StackOverflow, and thanks for your contribution! This is an answer to an already answered question. Please check: stackoverflow.com/help/how-to-answer
  • Andrii Artamonov
    Andrii Artamonov almost 4 years
    Thank you! For some reason, Appium couldn't read JAVA_HOME path from my bash_profile but from Edit Configuration menu the field was empty and when I pasted /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/‌​Home it started to work.
  • Jeff Wright
    Jeff Wright almost 4 years
    What is the "Appium app?" I've installed Appium and there are nothing but command line tools.