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

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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



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





solved it on my own
– SergioLeone
Oct 25 '16 at 4:26





Can you post your solution?
– Ryan Knell
Oct 27 '16 at 1:27




5 Answers
5



I needed to add



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


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



to ~/.bash_profile and restart the terminal





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.
– Joshua Pinter
Sep 9 '17 at 19:09


/



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



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





Thank, this worked for me
– Kiran Sk
Mar 18 at 12:26



I was making a rookie mistake and want to add it here so people dont repeat my mistake.



Instead of exporting $PATH and $JAVA_HOME, i was sourcing it from my /etc/environment file. As a result both showed up correct when I would use echo but my Appium install could not find it.



Then i found this out : Unix: What is the difference between source and export?



Basically you gotta export the variables from your bashrc so they get added to your global environment and appium can then access it.



I tried different things, everything was ok, but this file "Bin directory of $JAVA_HOME is not set" stayed. After that i wrote npm uninstall appium-doctor in bash, and after that everything was ok... you can try uninstall, then npm install appium-doctor


npm uninstall appium-doctor


npm install appium-doctor






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Keycloak server returning user_not_found error when user is already imported with LDAP

415 Unsupported Media Type while sending json file over REST Template

PHP parse/syntax errors; and how to solve them?