When I swap my JAVA_HOME to point to another env and close terminal and open it back up, I can echo it and it shows the right path.
However some other applications (n