It's Very easy to set a path in Linux. Do as follows :
Step-1 Open terminal and type sudo gedit .bashrc
Step-2 It will ask you your password. After typing the password ,it will open the bash file. Then go to end and type below
step-3
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
export PATH=$PATH:$JAVA_HOME/bin
step-4 Then save the file and exit from file
Above is for a single user. For all users, you have to follow below steps
Step-1 gedit /etc/profile
Step-2 export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
Step-3 export PATH=$PATH:$JAVA_HOME/bin
Hope this helps. Thanks!