如何为Selendroid配置JAVA_HOME

时间:2017-04-19 08:42:48

标签: java android selendroid

来自Selendroid的系统要求:

  

必须安装Java SDK(最低1.6)并配置JAVA_HOME。重要说明:如果JAVA_HOME指向Java运行时环境,则selendroid会产生错误,因为jarsigner之类的工具不可用!

然而,我的$ JAVA_HOME指向:

/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre

我相信这就是我无法启动Selendroid的原因:

...
Apr 19, 2017 9:14:07 AM io.selendroid.standalone.io.ShellCommand exec
INFO: Executing shell command: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre/bin/jarsigner -sigalg MD5withRSA -digestalg SHA1 -signedjar /var/folders/np/gn2yjy916jjg33h2tr3hly3w0000gn/T/resigned-android-driver7285920814303014295.apk -storepass android -keystore /Users/cruz/.android/debug.keystore /var/folders/np/gn2yjy916jjg33h2tr3hly3w0000gn/T/android-driver7285920814303014295.apk androiddebugkey
Apr 19, 2017 9:14:07 AM io.selendroid.standalone.io.ShellCommand exec
SEVERE: Error executing command: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre/bin/jarsigner -sigalg MD5withRSA -digestalg SHA1 -signedjar /var/folders/np/gn2yjy916jjg33h2tr3hly3w0000gn/T/resigned-android-driver7285920814303014295.apk -storepass android -keystore /Users/cruz/.android/debug.keystore /var/folders/np/gn2yjy916jjg33h2tr3hly3w0000gn/T/android-driver7285920814303014295.apk androiddebugkey
java.io.IOException: Cannot run program "/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre/bin/jarsigner" (in directory "."): error=2, No such file or directory
...

我应该在$JAVA_HOME中设置哪条路径?

(注意:我使用的是Mac OS X 10.10.5)

2 个答案:

答案 0 :(得分:0)

所以我终于想出了JDK而不是JRE的路径:

/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home

答案 1 :(得分:0)

首先,您必须获取保存内容SDK的路径。

路径:/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home /

如果您已提交.bash_profile文件,请输入:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/
export PATH=$PATH:JAVA_HOME