if you are trying with this java -version
java -version
so that was not working!
Tryout this javac -version
javac -version
Now i think it should be worked properly ..