I am trying to run java -version on a remote linux machine using ssh in the following manner-
ssh ravi@192.168.3.90 "java -version"
I am getting bash: java: command not found.
But java is installed on the remote machine and I have kept JAVA_HOME in both the file i.e. /etc/profile and ~/.bashrc. I can get the java -version on it while running directly on it.
Why? My objective is the get java version. What changes are required to get the version of installed java on remote linux machine?