最近接手舊的專案,用到
Java Web Start 應用程式(.jnlp)
。而當在外地出差,連線到遠端電腦,執行遠端 win10 底下的 Java 應用程式(.jnlp),卻呈現全白。而實際坐在該電腦前操作,可以正常執行和顯示畫面。此問題苦惱許久,最近終於解決了
本文連結: https://hackmd.io/@kmo/java_blank_issue
情境 | 狀態 |
---|---|
win10 電腦前 | 開啟 .jnlp 正常顯示 |
遠端桌面到 win10 | 開啟 .jnlp 呈現空白 |
Remote Desktop
剛好是一個通用詞彙,幸運在 teamviewer 的社群看到類似問題討論,並且持續討論 3 年以上。之所以判斷 teamviewer 討論也適用,是因為此現象看起來都和 Java 應用程式有關,並且觀察其他搜尋結果,透過遠端桌面都有類似 issue@mattmill30
,測試各種解法,比如測試 Java 環境變數都失敗,最後是把 win10 的顯示相關的硬體加速功能關閉,即可修正@mattmill30
回覆完整內容This answer expands upon @Julia's, second point 'Window contents that are drawn hardware-accelerated (e.g. browser content or 3D applications / games) are no longer drawn (you cannot see the application)'.
See 'Solution' below.
I have noticed this issue commonly relates to Java applications when the primary monitor is no-longer attached to the device; such as certain laptops which "disconnect" the built-in screen when the lid is shut - corroborated by @ashimet - or workstations when no screens are attached.
Based upon the behaviour of applications with and without a monitor attached, a surface level understanding of graphics accelerators (https://en.wikipedia.org/wiki/Framebuffer#Graphics_accelerators), and experiences in the forum posts I've referenced below, I believe the cause of the contentless windows is the result of application dependencies upon either the DirectDraw or Direct3D sub-systems - which interface with 3D acceleration hardware - when the accelerators are disabled as a result of the disconnection of a monitor.
I think I've also experienced similar problems when attempting to run applications which depend upon 3D acceleration within a Linux environment using the Wine compatibility layer (https://bugs.winehq.org/buglist.cgi?component=directx-d3d&product=Wine&resolution=–-)
Perhaps this is a power-saving feature of 3D graphics processors which activates when no screens are detected, or perhaps this is related to the framebuffer being unaware of the supported output resolutions and so disables access to the GPU for the Windows shell, which causes Windows to revert to software-only rendering; or some other reason.
Whatever the cause, my assumption that the dedicated graphics hardware was unavailable for 3D processing when the monitor is disabled, and the common denominator for all software experiencing the problem was Java, I questioned whether the JVM was depending upon D3D for rendering, even though Windows only had software-only rendering available.
Ref: https://superuser.com/a/496775 Using DXDiag, I checked the status of Display DirectX Features:
I manually created these registry values, in addition to creating the Direct3D\Drivers key:
Then, using DXDiag, I checked the new status of Display DirectX Features:
The Java program window now rendered content correctly via VNC Viewer, when monitor is detached.
I've not tried the "ForceDirectDrawEmulation" option within the Compatibility Wizard suggestion from the referenced SuperUser thread.
DirectDraw 加速
和 Direct3D 加速
,從 已啟用
變成 已停用
dxdiag.exe
檢查,點選顯示
,看到 DirectX 功能
地方,預設應是已啟用
狀態script.cmd
,使用系統管理員權限執行 script.cmd
即可dxdiag.exe
檢查,點選顯示
,看到 DirectX 功能
地方,應改為已停用
狀態
Set _Mode=0
再執行一次即可恢復