How to set JAVA_HOME in Linux for all users

  1. find /usr/lib/jvm/java-1.x.x-openjdk
  2. vim /etc/profilePrepend sudo if logged in as not-privileged user, ie. sudo vim
  3. Press ‘i’ to get in insert mode
  4. add:export JAVA_HOME="path that you found" export PATH=$JAVA_HOME/bin:$PATH
  5. logout and login again, reboot, or use source /etc/profile to apply changes immediately in your current shell

Leave a Comment