编辑
2026-05-03
主机教程
00

目录

撤销方法

右键 PowerShell 或 Windows Terminal,执行:

ps1
powershell -ExecutionPolicy Bypass -File .\fix-uclient-java-proxy.ps1

执行后:

  1. 完全关闭 UClient;
  2. 任务管理器结束所有 javaw.exe;
  3. 重新打开 UClient;
  4. 再进财务系统。

撤销方法

如果以后要恢复:

ps1
powershell -ExecutionPolicy Bypass -File .\fix-uclient-java-proxy.ps1 -Undo

脚本做的事主要是设置当前用户环境变量:

js
_JAVA_OPTIONS=-Djava.net.useSystemProxies=false ... JAVA_TOOL_OPTIONS=-Djava.net.useSystemProxies=false ...
ps1
<# .SYNOPSIS Fix Yonyou UClient / U8 Cloud slow startup caused by Java using Windows proxy. .DESCRIPTION UClient launches javaw.exe with -Djava.net.useSystemProxies=true, so Java may use Qv2ray/V2Ray/Clash local proxy and get stuck on euc.yonyoucloud.com with errors such as "Malformed reply from SOCKS server". This script sets user-level Java environment variables so Java ignores system proxy, while keeping your proxy client usable for other applications. .USAGE PowerShell: powershell -ExecutionPolicy Bypass -File .\fix-uclient-java-proxy.ps1 Then fully close UClient and all javaw.exe processes, and reopen UClient. To undo: powershell -ExecutionPolicy Bypass -File .\fix-uclient-java-proxy.ps1 -Undo #> param( [switch]$Undo ) $ErrorActionPreference = 'Stop' $NonProxyHosts = '112.74.98.8|*.yonyou.com|*.yonyoucloud.com|59.110.247.93|39.98.81.66|localhost|127.*' $JavaOptions = "-Djava.net.useSystemProxies=false -Dhttp.proxyHost= -Dhttps.proxyHost= -DsocksProxyHost= -Dhttp.nonProxyHosts=$NonProxyHosts -Dhttps.nonProxyHosts=$NonProxyHosts" function Broadcast-EnvironmentChange { $code = @' using System; using System.Runtime.InteropServices; public static class EnvBroadcast { [DllImport("user32.dll", SetLastError=true, CharSet=CharSet.Auto)] public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, uint fuFlags, uint uTimeout, out UIntPtr lpdwResult); } '@ try { $type = Add-Type -TypeDefinition $code -PassThru -ErrorAction Stop $result = [UIntPtr]::Zero [void]$type::SendMessageTimeout([IntPtr]0xffff, 0x001A, [UIntPtr]::Zero, 'Environment', 0x0002, 5000, [ref]$result) } catch { Write-Warning "Environment broadcast failed: $($_.Exception.Message)" } } function Show-ProxyState { try { $p = Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' Write-Host '' Write-Host 'Current Windows proxy:' Write-Host " ProxyEnable : $($p.ProxyEnable)" Write-Host " ProxyServer : $($p.ProxyServer)" Write-Host " ProxyOverride : $($p.ProxyOverride)" } catch { Write-Warning "Could not read Windows proxy settings: $($_.Exception.Message)" } } if ($Undo) { [Environment]::SetEnvironmentVariable('_JAVA_OPTIONS', $null, 'User') [Environment]::SetEnvironmentVariable('JAVA_TOOL_OPTIONS', $null, 'User') Broadcast-EnvironmentChange Write-Host 'Removed user-level _JAVA_OPTIONS and JAVA_TOOL_OPTIONS.' Write-Host 'Please fully close and reopen UClient.' Show-ProxyState exit 0 } # _JAVA_OPTIONS is intentionally used because it is applied after command-line -D options # by this Java runtime, so it overrides UClient's -Djava.net.useSystemProxies=true. [Environment]::SetEnvironmentVariable('_JAVA_OPTIONS', $JavaOptions, 'User') # Keep JAVA_TOOL_OPTIONS in sync for tools/JREs that read it, although _JAVA_OPTIONS is # the important one for UClient's bundled Java 8. [Environment]::SetEnvironmentVariable('JAVA_TOOL_OPTIONS', $JavaOptions, 'User') Broadcast-EnvironmentChange Write-Host 'UClient Java proxy bypass has been installed for the current Windows user.' Write-Host '' Write-Host 'Set user environment variables:' Write-Host " _JAVA_OPTIONS=$JavaOptions" Write-Host " JAVA_TOOL_OPTIONS=$JavaOptions" Write-Host '' Write-Host 'Next steps:' Write-Host ' 1. Fully close UClient.' Write-Host ' 2. End all javaw.exe processes from Task Manager if any remain.' Write-Host ' 3. Reopen UClient and enter U8 Cloud / finance system again.' Write-Host '' Write-Host 'To undo this change:' Write-Host ' powershell -ExecutionPolicy Bypass -File .\fix-uclient-java-proxy.ps1 -Undo' Show-ProxyState
如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:7

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 转载请注明出处 许可协议。转载请注明出处!