Java禁用dpi-aware不起作用 [英] Java disable dpi-aware not working

查看:11
本文介绍了Java禁用dpi-aware不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 -Dsun.java2d.dpiaware=false 参数运行 Java 应用程序,但没有任何反应.

I'm trying to run a Java application with -Dsun.java2d.dpiaware=false argument but nothing happens.

我希望有一个模糊的用户界面,但图标和字体的大小正常,这个标志似乎不起作用.

I expect to have a blurred UI but with normal size of icons and fonts, it seems that this flag does not work.

我在 Windows 8.1 上使用 JDK 1.8.0_45.

I'm using JDK 1.8.0_45 on Windows 8.1.

我发现了这个错误 https://bugs.openjdk.java.net/browse/JDK-8080153 但我不明白如何解决它.

I found this bug https://bugs.openjdk.java.net/browse/JDK-8080153 but I don't understand how to workaround it.

推荐答案

针对 Windows 进行修复,请按照下列步骤操作:

  • 创建一个 windows regedit 新的 DWORD

    Fix for Windows, follow these steps:

    • Create a windows regedit new DWORD

      1. 按 Windows 按钮 + R,键入regedit",然后单击确定".
      2. 导航到以下注册表子项:
        HKEY_LOCAL_MACHINE > 软件 > Microsoft > Windows > CurrentVersion > SideBySide
      3. 右键单击,选择 NEW > DWORD(32 位)值
      4. 输入 PreferExternalManifest,然后按 ENTER.
      5. 右键单击 PreferExternalManifest,然后单击修改.
      6. 输入数值数据 1 并选择十进制.
      7. 点击确定.

    • 创建两个 .manifest 文件(JDK)

      1. 转到您的 java JDK 安装文件夹并打开 bin 目录
      2. 创建第一个名为 java.exe.manifest 的文件(在本文末尾添加代码).
      3. 创建另一个名为 javaw.exe.manifest 的文件(在本文末尾添加代码).

    • 创建两个 .manifest 文件 (JRE)

      1. 转到您的 java JRE 安装文件夹并打开 bin 目录
      2. 创建第一个名为 java.exe.manifest 的文件(在本文末尾添加代码).
      3. 创建另一个名为 javaw.exe.manifest 的文件(在本文末尾添加代码).

    • 重新启动您的 Java 应用程序.

    • Restart your java application.

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      
      <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
      
      <dependency>
        <dependentAssembly>
          <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0" processorArchitecture="*"
            publicKeyToken="6595b64144ccf1df"
            language="*">
          </assemblyIdentity>
        </dependentAssembly>
      </dependency>
      
      <dependency>
        <dependentAssembly>
          <assemblyIdentity
            type="win32"
            name="Microsoft.VC90.CRT"
            version="9.0.21022.8"
            processorArchitecture="amd64"
            publicKeyToken="1fc8b3b9a1e18e3b">
          </assemblyIdentity>
        </dependentAssembly>
      </dependency>
      
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel
              level="asInvoker"
              uiAccess="false"/>
          </requestedPrivileges>
        </security>
      </trustInfo>
      
      <asmv3:application>
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
          <ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</ms_windowsSettings:dpiAware>
        </asmv3:windowsSettings>
      </asmv3:application>
      
      </assembly>
      

      此修复程序可用于任何程序,而不仅仅是 Java.

      This fix can be used for any program, not only Java.

      如果您需要修复 JNLP 应用程序启动器的 DPI,您必须将以下键添加到 .jnlp 文件中的资源部分:

      If you need to fix the DPI for a JNLP application launcher, you have to add the following key to the resources section inside the .jnlp file :

      升级 Windows 后(例如从 win10 到 win10 1607),如果它不再起作用,您应该再次应用此修复程序.

      这篇关于Java禁用dpi-aware不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆