Could not get the Java version. Is Java installed?

I try to run appium

with this .zprofile file:

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
export ANDROID_HOME='/Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/'

and with this termianl run:

➜  ~  java -version                
Picked up _JAVA_OPTIONS: -Dhttps.proxyHost=cache.corp.google.com -Dhttps.proxyPort=3128
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
➜  ~  echo $ANDROID_HOME
/Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/
➜  ~  echo $JAVA_HOME   
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home

and get this error:

error: Failed to start an Appium session, err was: Error: Could not get the Java version. Is Java installed?

info: [debug] Error: Could not get the Java version. Is Java installed?
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-common.js:1040:17
    at ChildProcess.exithandler (child_process.js:735:7)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1008:16)
    at Socket.<anonymous> (child_process.js:1176:11)
    at Socket.emit (events.js:107:17)
    at Pipe.close (net.js:476:12)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not get the Java version. Is Java installed?)","origValue":"Could not get the Java version. Is Java installed?"},"sessionId":null}
info: <-- POST /wd/hub/session 500 118.081 ms - 222 

why is Could not get the Java version. Is Java installed?

Hi @Eladbdv,

Could you try with Java 1.7 and check if it works for you?

Thanks,
Sujata

doesn’t work.

new console opened:

➜  ~  echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home

Doctor:

Running Android Checks
✔ ANDROID_HOME is set to "/Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/"
✔ JAVA_HOME is set to "/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home."
✔ ADB exists at /Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/platform-tools/adb
✔ Android exists at /Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/tools/android
✔ Emulator exists at /Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/tools/emulator
✔ Android Checks were successful.

✔ All Checks were successful
➜  ~  

and yet appium says:

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.5","revision":"a124a15677e26b33db16e81c4b3b34d9c6b8cac9"}}}
info: <-- GET /wd/hub/status 200 0.927 ms - 104 {"status":0,"value":{"build":{"version":"1.3.5","revision":"a124a15677e26b33db16e81c4b3b34d9c6b8cac9"}}}

info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"com.grindrapp.android","appActivity":".activity.SplashActivity","platformVersion":"4.4.2","browserName":"","platformName":"Android","deviceName":"10.0.0.9:5555"}}

info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)

info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device

info: [debug] Creating new appium session e232fa9d-a70c-4de9-84e7-d86441cc9dc6

info: Starting android appium

info: [debug] Getting Java version

info: [debug] Cleaning up android objects

info: [debug] Cleaning up appium session

info: [debug] Error: Could not get the Java version. Is Java installed?
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-common.js:1040:17
    at ChildProcess.exithandler (child_process.js:735:7)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1008:16)
    at Socket.<anonymous> (child_process.js:1176:11)
    at Socket.emit (events.js:107:17)
    at Pipe.close (net.js:476:12)

error: Failed to start an Appium session, err was: Error: Could not get the Java version. Is Java installed?

info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not get the Java version. Is Java installed?)","origValue":"Could not get the Java version. Is Java installed?"},"sessionId":null}
info: <-- POST /wd/hub/session 500 87.838 ms - 222 

info: --> GET /wd/hub/status {}

I’m using appium 1.3.5