linux - -bash: java: command not found in Centos5 -


# java -version -bash: java: command not found 

i have jdk1.8.0_40 folder in usr/local. when navigate folder , type alternatives --config jar, such output

there 1 program provides 'jar'.        selection    command     -----------------------------------------------     *+ 1           /opt/jdk1.8.0_40//bin/jar      enter keep current selection[+], or type selection number:  

these content in jdk

bin    include     lib      readme.html  thirdpartylicensereadme-javafx.txt copyright  javafx-src.zip  license  release  thirdpartylicensereadme.txt db     jre         man      src.zip 

you need install java first:

alternatives --install /usr/bin/java java <path java>  

change var in above command appropriate location of java file, example: /usr/local/jdk/bin/java

and run following command set default java:

alternatives --config java 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -