'java -version' failed

Hi,

Can someone tell how to resolve is this error

Error : Failed to start an Appium session, err was: Error: ‘java -version’ failed. Error: Command failed: /bin/sh -c java -version
/bin/sh: java: command not found**

Thank you,

D.Santhosh

This looks like a Linux system.

Is Java installed on your system? If not, use your system’s package manager to install it (e.g. apt for Debian systems).

I m using Mac OS. Java is already installed

Ah, that’s very strange then. Apple usually installs their own version of Java to Mac computers.

Can you go ahead and double check if Java is installed and set up correctly by running java -version manually on the command line?

If Java is installed, you might want to check if the PATH environment variable for Appium is correct. How are you launching Appium?

I use javac -version in terminal it shows the correct version. And Even Java path is set correctly. I’m using Appium as App(ie… Appium.exe)

And how to check the PATH environment variable for Appium is correct or not??

I normally launch Appium through a shell script on startup on my machines. When I was setting up my scripts, I needed to check what my PATH was, so I simply added an echo $PATH command before the Appium command.

In your case, you’re using the GUI. Do you have a JAVA_HOME environment variable exported from your .profile file? You might need that on OS X for Appium to find Java properly.