# Fish Java Environment Switch - {{env_name}}
# Generated by fnva

# Set new JAVA_HOME and prepend to PATH
set -gx JAVA_HOME "{{java_home}}"
set -gx PATH "{{java_bin}}" $PATH

# Set fnva environment tracking
set -gx FNVA_CURRENT_JAVA "{{env_name}}"
set -gx FNVA_ENV_TYPE "Java"

# Verify the switch
if not set -q _FNVA_QUIET
    echo "[OK] Switched to Java environment: {{env_name}}"
    echo "[DIR] JAVA_HOME: $JAVA_HOME"
    echo "[INFO] Java Version:"
    if test -x "{{java_bin}}/java"
        "{{java_bin}}/java" -version 2>&1 | head -n 1 | sed 's/^/   /'
    else
        echo "   Failed to get Java version"
    end
end
