我的JAVA_HOME路径不正确?

时间:2016-12-29 19:48:17

标签: path .bash-profile

这是迈出的一步: http://docs.ionic.io/services/auth/google-native.html

我试图用:

生成SH1键
keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

我收到以下错误:

keytool error: java.lang.Exception: Keystore file does not exist: /Users/alex_fimm_dev/.android/debug.keystore
java.lang.Exception: Keystore file does not exist: /Users/alex_fimm_dev/.android/debug.keystore
    at sun.security.tools.keytool.Main.doCommands(Main.java:745)
    at sun.security.tools.keytool.Main.run(Main.java:343)
    at sun.security.tools.keytool.Main.main(Main.java:336)

我怀疑JAVA_HOME路径出了什么问题?

这是我的.bash_profile

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/alex_fimm_dev/Desktop/Databases/Mongo/mongodb/bin:/Users/alex_fimm_dev/Desktop/Databases/Mongo/mongodb/bin

# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH

# Homebrew
export PATH=/usr/local/bin:$PATH

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

# android and java paths
export JAVA_HOME=/Library/Java/Home/
export ANDROID_HOME=/usr/local/Cellar/android-sdk/
export PATH=${PATH}:/usr/local/Cellar/android-sdk/24.4.1_1/platform-tools:/usr/local/Cellar/android-sdk/24.4.1_1/tools

如果我转到密钥库文件的位置:

lm5-fim4-0G3QD:~ alex_fimm_dev$ cd ~/.android/
lm5-fim4-0G3QD:.android alex_fimm_dev$ keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore
Unable to locate an executable at "/Library/Java/Home/bin/bin/keytool" (-1)
lm5-fim4-0G3QD:.android alex_fimm_dev$ 

enter image description here

2 个答案:

答案 0 :(得分:0)

解决方案:

在我的所有终端中更新路径,例如:

source ~/.bash_profile

生成{/ 1}}在〜/ .android中缺失,如:

.keystore

答案 1 :(得分:0)

你的java和android路径就像这样::

ANDROID_HOME=/home/user_name/Android/Sdk

JAVA_HOME=/usr/lib/jvm/java-8-oracle

如果希望它永久化,只需在〜/ .bashrc文件中添加这些行