Setting JAVA_HOME in fish:

set -U JAVA_HOME (which java)
  • -U is universal scope, persisting beyond the current process to sub-processes.
  • (...) is an eval.

Ref: http://fishshell.com/docs/current/index.html#variables