Java 通过远程桌面渲染

Java rendering over remote desktop

我正在尝试 运行 我在 windows7 下通过远程桌面在 RHEL7 服务器中制作的 java 程序。

服务器中的所有 java 程序都无法通过远程桌面呈现。如果我在服务器位置访问服务器本身,它们看起来还不错。

我在其他线程中看到更改 nvidia 配色方案等会有所帮助,但是服务器使用的是默认图形。

我想通了:

  • 启动远程连接时,打开连接选项。
  • 转到屏幕
  • 转到颜色
  • 选择 16 位颜色。

完成。

您出现问题的原因可能是您作为另一个用户连接 and/or 作为远程桌面用户具有不同的权限。我在 xrdp 上遇到过这些问题。 尝试 TeamViewer 或其他远程桌面解决方案。

当通过 RDP 连接到 Windows 7 机器时,这有效:

  • 启动远程连接时,打开连接选项;
  • 转到“显示”选项卡;
  • 在颜色中,选择高色(15 位)

接受的答案对我不起作用,但指出了这个方向 (我会post评论,但目前我的声望不够)。

此答案扩展了 TeamViewer 线程中关于“Some applications does not show content (white window) Windows 10 host”的详细解决方案。

请参阅下面的“解决方案”。

摘要

我注意到这个问题通常与 Java 应用程序相关,当主监视器 no-longer 连接到设备时;例如某些笔记本电脑 "disconnect" 关闭盖子时 built-in 屏幕或未连接屏幕时的工作站。

根据连接和不连接显示器的应用程序的行为、对 graphics accelerators 的表面理解以及我在下面引用的论坛帖子中的经验,我认为内容不足的原因 windows 是应用程序依赖于 DirectDraw 或 Direct3D sub-systems(与 3D 加速硬件接口)的结果,当加速器因显示器断开连接而被禁用时。

我想我在尝试 运行 应用程序时也遇到过类似的问题,这些应用程序在 Linux 环境中使用 Wine 兼容层 (https://bugs.winehq.org/buglist.cgi?component=directx-d3d&product=Wine&resolution=---)

也许这是 3D 图形处理器的 power-saving 功能,当没有检测到屏幕时激活,或者这可能与帧缓冲区不知道支持的输出分辨率有关,因此禁用对 GPU 的访问Windows shell,这会导致 Windows 恢复为 software-only 渲染;或者其他原因。

不管是什么原因,我的假设是当显示器被禁用时专用图形硬件无法进行 3D 处理,并且所有遇到问题的软件的共同点是 Java,我怀疑 JVM 是否是取决于 D3D 渲染,即使 Windows 只有 software-only 渲染可用。

解决方案

参考:https://superuser.com/a/496775

使用 DXDiag,我检查了显示 DirectX 功能的状态:

DirectDraw Acceleration: Enabled

Direct3D Acceleration: Enabled

AGP Texture Acceleration: Enabled

除了创建 Direct3D\Drivers 项之外,我还手动创建了这些注册表值:

Reg Add HKLM\SOFTWARE\Microsoft\DirectDraw /V EmulationOnly /T REG_DWORD /D %_Mode% /F

Reg Add HKLM\SOFTWARE\Microsoft\Direct3D\Drivers /V SoftwareOnly /T REG_DWORD /D %_Mode% /F

然后,使用 DXDiag,我检查了 Display DirectX Features 的新状态:

DirectDraw Acceleration: Disabled

Direct3D Acceleration: Disabled

AGP Texture Acceleration: Not Available

Java 程序 window 现在可以在分离监视器时通过 VNC 查看器正确呈现内容。

我没有尝试过在兼容性向导中使用 "ForceDirectDrawEmulation" 选项的建议,在 SuperUser 线程中引用。

研究与参考

在下面的每个标题中都有论坛帖子的记录,这些帖子被认为是导致上述解决方案的研究的一部分。

每个部分都以引用线程中提出的解决方案的应用结果记录或线程与我的环境不相关的原因结束;但解决方案可能与其他人相关。

在 Windows 显示设置中禁用硬件加速

参考:https://www.auslogics.com/en/articles/disable-hardware-acceleration-in-windows/

Not tried because Display Settings window crashes

尝试阻止 GPU (ATI Mobility Radeon HD 4500) 在显示器断开连接时禁用硬件加速

参考:https://social.technet.microsoft.com/forums/windows/en-us/8a9b5aa7-fe33-4e6d-b39b-8ac80a21fdc2/disable-monitor-off-detection-how?forum=w7itprogeneral

已禁用?显示检测?,以防止检测到断开连接以避免禁用硬件加速

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}[=11=]00]
"Display_Detection_DEF"=dword:00000001

Create/NULL ATI 卡的 DMMEnableDDCPolling - 参考:Post by NetMage

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}[=12=]00]
"DMMEnableDDCPolling"=dword:00000000

Didn't have any affect following system restart, though the laptop lid was closed during reboot. Though even if it did work, this likely would not have been a suitable solution.

A much more appropriate solution would be if the 3D hardware acceleration could be forced 'always-on', regardless of monitor detection.

System-wide(Java 控制面板)禁用 Java 应用程序的 D3D 加速

参考:https://forums.guru3d.com/threads/disable-hardware-acceleration-for-java.296918/#post-4096709

Not tried because Java Control Panel isn't present on my system

System-wide(环境变量)禁用 Java 应用程序的 D3D 加速

参考:https://whosebug.com/a/36235217

Java 2D 的系统属性:http://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html

正在设置用户环境变量:

_JAVA_OPTION=-Dsun.java2d.d3d=false -Dsun.java2d.noddraw=true

J2D_D3D=false

If this had worked, it would have been the ideal solution, since it is a Java specific configuration, as opposed to the solution presented above, which requires a full system change in order to compensate for a Java-specific issue.

However, setting the Environment Variables didn't resolve the contentless Window issue for me.

Perhaps the documentation for JRE 8 is outdated, and an alternate method is available for newer releases. Once I'd realised the solution, I didn't go searching for more recent documentation or an alternate solution.

在 Windows 上禁用 Direct3D 加速 7

参考:How to disable Direct3D Acceleration on Windows 7?

directx.cpl 指南 - 更改 32 位 DirectDraw 和 Direct3D,但不更改 64 位(dxdiag 32/64 位):https://whosebug.com/a/25508331

I'm not running a 32-bit version of Windows 7

在 Windows 8[/10]

上禁用 DirectDraw 和 Direct3D 加速

参考:https://superuser.com/questions/495303/how-do-i-disable-directdraw-and-direct3d-acceleration-on-windows-8

directx.cpl 指南 - 更改 32 位 DirectDraw 和 Direct3D,但不更改 64 位(dxdiag 32/64 位):https://superuser.com/a/504510

I'm running a 64-bit version of Windows 10, and the Java applications are also 64-bit, so 32-bit DirectDraw and Direct3D settings aren't relevant for me, though the 32-bit directx.cpl did disable the 32-bit DirectDraw and Direct3D as verified by the 32-bit DXDiag.

The registry keys and procedure for disabling the 64-bit DirectDraw and Direct3D are detailed in the solution section above.

从远程会话注销(不仅仅是断开连接)为我更改了它。也许这个答案对某些以 post 结尾的人有帮助,因为他们在 Java 应用程序上有一个有趣的超大边框 在与远程连接闲逛后。

我使用 mac parallels 软件通过 windows 10 远程连接。然后我对 parallels 进行了配置更改。然后我在 mac 上设置了一个 vpn 和远程连接并遇到了问题。我在远程站点注销并重新登录,它变得“正常”。