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

# 设置UTF-8编码以正确显示中文
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$OutputEncoding = [System.Console]::OutputEncoding

# Clean previous fnva-managed path, then set new JAVA_HOME
if ($env:FNVA_JAVA_BIN) {
    $env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne $env:FNVA_JAVA_BIN }) -join ';'
}
$env:FNVA_JAVA_BIN = "{{escape_backslash java_bin}}"
$env:JAVA_HOME = "{{escape_backslash java_home}}"
$env:PATH = "{{escape_backslash java_bin}};" + $env:PATH

# Set fnva environment tracking
$env:FNVA_CURRENT_JAVA = "{{env_name}}"
$env:FNVA_ENV_TYPE = "Java"

# Verify the switch
if (-not $env:_FNVA_QUIET) {
    Write-Host "✓ Switched to Java: {{env_name}}" -ForegroundColor Green
}
