Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT)

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 937
    Comment on it

    The first step to use Appium is to configure the system and the most common error that usually comes while configuring Appium is: Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT)

    The following reasons may be possible of this uneven behavior:

    1. ANDROID_HOME variable might not be set.
    2. JAVA_HOME variable might not be set.
    3. Make sure that ADB exists under Android_SDK\platform-tools.
    4. Also make sure that Android exist under Android_SDK\tools.

    To confirm that everything is set correctly, just run appium-doctor -android from the command prompt. Please make sure that you are running this command from .bin folder; eg: "C:\Program Files (x86)\Appium\node_modules\.bin". If everything is already set correctly then the following output should be displayed on command prompt:

    C:\Program Files (x86)\Appium\node_modules\.bin>appium-doctor -android
    Running Android Checks
    ? ANDROID_HOME is set to "E:\Android test\adt-bundle-windows-x86_64-20140702\adt
    ? JAVA_HOME is set to "C:\Program Files\Java\jdk1.8.0."
    ? ADB exists at E:\Android test\adt-bundle-windows-x86_64-20140702\adt-bundle-wi
    ? Android exists at E:\Android test\adt-bundle-windows-x86_64-20140702\adt-bundl
    ? Emulator exists at E:\Android test\adt-bundle-windows-x86_64-20140702\adt-bund
    ? Android Checks were successful.
    ? All Checks were successful

    After setting all the above components if still you are facing the same issue then set system32 location as the PATH variable in environment variables. Add %SystemRoot%\system32 at the end of PATH variable in System variables.

    system variable

    Save all the changes and restart the system. Now try to run the Appium code and you will not face the above issue.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: