错误:命令“java -version”以代码 20 退出
Posted
技术标签:
【中文标题】错误:命令“java -version”以代码 20 退出【英文标题】:Error: Command 'java -version' exited with code 20 【发布时间】:2018-08-06 19:08:48 【问题描述】:-
我从它抛出的 Eclipse 运行 android 自动化测试
运行命令时遇到内部错误:错误:命令 'java -version' exited with code 20
Appium Logfile:
`[BaseDriver] Event 'newSessionRequested' logged at 1519716463353
(12:57:43 GMT+0530 (IST)) [Appium] Merged W3C capabilities
"desiredCapabilities":"app":"/Users/sathish/S... into
desiredCapabilities object
"app":"/Users/sathish/Sathish/CASA/Automation ... [Appium] Creating
new AndroidDriver (v1.39.0) session [Appium] Capabilities: [Appium]
app: /Users/sathish/Sathish/CASA/Automation
Test/EndlessAisleAutomationTest/app/app-qa-debug.apk [Appium]
appActivity: tech.ajira.endlessAisle.activities.TenantLoginActivity
[Appium] appPackage: tech.ajira.endlessAisle [Appium]
deviceName: Google Nexus 9 [Appium] platformName: android
[BaseDriver] [BaseDriver] W3C capabilities [] and MJSONWP desired
capabilities were provided [BaseDriver] Expected W3C "capabilities"
to be a JSON Object but was provided with: [] [BaseDriver] Falling
back to MJSONWP desired capabilities [BaseDriver] Session created
with session id: e1e27d58-611a-4877-b8fc-8e7e98351be1
[AndroidDriver] Getting Java version [AndroidDriver] Shutting down
Android driver [AndroidDriver] Called deleteSession but bootstrap
wasn't active [MJSONWP] Encountered internal error running command:
Error: Command 'java -version' exited with code 20
at ChildProcess. (/Applications/Appium.app/Contents/Resources/app/node_modules/teen_process/lib/teen_process.js:97:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at maybeClose (internal/child_process.js:899:16)
at Socket. (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at Pipe._handle.close [as _onclose] (net.js:510:12) [HTTP] <-- POST /wd/hub/session 500 41 ms - 180`
Please help me to fix this issue. Thank you
【问题讨论】:
【参考方案1】:似乎 Appium 无法连接到正在运行的模拟器。尝试为deviceName
和platformVersion
功能设置正确的值以查找连接的设备。
在命令提示符下尝试运行adb devices
以获取设备名称。
【讨论】:
我检查了deviceName
和platformVersion
。它具有正确的值。我使用 WebDriver 运行相同的代码,它正在工作,对于 AndroidDriveradb devices
获得的deviceName
。
感谢您的回复。我修好了。问题是我设置了错误的 JAVA_HOME 环境变量以上是关于错误:命令“java -version”以代码 20 退出的主要内容,如果未能解决你的问题,请参考以下文章
Linux下在.bash_profile文件下配置JDK环境变量,生效后执行java -version命令后提示错误信息如下:
mvn -version 错误:我们无法执行 /usr/libexec/java_home/bin/java