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

# Remove existing Java paths from 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
echo "✅ Switched to Java environment: {{env_name}}"
echo "📁 JAVA_HOME: $JAVA_HOME"
echo "🔍 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

# Add to command history
echo "fnva java use {{env_name}}" >> ~/.fnva/history 2>/dev/null || true