Java禁用dpi-aware无法正常工作 [英] Java disable dpi-aware not working

查看:169
本文介绍了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.

我希望UI模糊,但是图标和字体的大小正常,似乎这个标志不起作用。

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

我正在使用JDK 1.8 Windows 8.1上的.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> SOFTWARE> Microsoft> Windows> CurrentVersion> SideBySide

      3. 右键单击,选择新建> DWORD(32位)值

      4. 输入Pre ferExternalManifest,然后按ENTER键。

      5. 右键单击PreferExternalManifest,然后单击修改。

      6. 输入数值数据1并选择十进制。

      7. 单击确定。

      1. Press Windows Button + R, type "regedit", and then click OK.
      2. Navigate to the following registry subkey:
        HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Windows > CurrentVersion > SideBySide
      3. Right-click, select NEW > DWORD (32 bit) Value
      4. Type PreferExternalManifest, and then press ENTER.
      5. Right-click PreferExternalManifest, and then click Modify.
      6. Enter Value Data 1 and select Decimal.
      7. Click OK.


    • 创建两个.manifest文件( JDK


      1. 转到java JDK安装文件夹并打开bin目录

      2. 创建一个第一个名为java.exe.manifest的文件(在这篇文章的末尾添加代码)。

      3. 创建第二个名为javaw.exe.manifest的文件(在此末尾添加代码) post)。


    • 创建两个.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 :

      < property name =sun.java2d.dpiawarevalue =false/>

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

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

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