#!/bin/bash
# Bash/Zsh Java Environment Switch - {{env_name}}
# Generated by fnva

# Clean previous fnva-managed path, then set new JAVA_HOME
if [ -n "${FNVA_JAVA_BIN:-}" ]; then
    PATH="${PATH//${FNVA_JAVA_BIN}:/}"
fi
export FNVA_JAVA_BIN="{{java_bin}}"
export JAVA_HOME="{{java_home}}"
export PATH="$FNVA_JAVA_BIN:$PATH"

# Set fnva environment tracking
export FNVA_CURRENT_JAVA="{{env_name}}"
export FNVA_ENV_TYPE="Java"

# Verify the switch
if [[ -z "$_FNVA_QUIET" ]]; then
    printf '\033[32m✓\033[0m Switched to Java: {{env_name}}\n'
fi
