Friday, July 29, 2016

Java and High DPI Displays

Are you running into issues with your Ignition Designer (or runtime) being extremely small on a high DPI display?

Your not alone. A lot of our customers are running into this issue. Ignition's Designer and runtime are Java Swing applications. The problem is that Java Swing claims that they are DPI aware, but they're not, so Windows doesn't scale it.

Unfortunately, this is not something that Oracle will fix, however, there is a way around it by modifying the EXE manifests for java.exe and javaw.exe and javaws.exe. 

This fix requires a resource editor and is for Java 8 or higher. I used Resource Hacker to modify the EXE manifests.

Follow these instructions:
  1. Install Resource Hacker
  2. Run Resource Hacker with administrative privileges
  3. Open java.exe from the installed Java 8 JRE (or JDK) path. Example:

    C:\Program Files\Java\jre1.8.0_51\bin\java.exe

    Note: If you have multiple versions of Java 8 installed you will have follow these steps for each one.
  4. Expand folder 24
  5. Expand folder 1
  6. Click on node 0 and you will see XML on the right
  7. Locate the dpiAware setting under application:

    <dpiAware>true</dpiAware>

    and change true to false:

    <dpiAware>false</dpiAware>



  8. Press the Compile Script button at the top
  9. Save your changes through File > Save
  10. Follow the same instructions for javaw.exe and javaws.exe. Make sure to do this for all Java versions (JRE and JDK) you have.
  11. Make sure to use the Native Client Launcher for Ignition. 
That's it. Now you can set your scaling to 150% or 200% in Windows and the Ignition Designer will look much better. You may have to restart your computer for the settings to take affect. 

Note: If you are using the 64-bit JRE make sure you are applying these changes to java.exe in Program Files not Program Files (x86) and vice-versa. 

Also, if you update your JRE to a newer version you must follow these steps for the new java.exe and javaw.exe.

2 comments:

  1. How can we do this for Linux clients? We plan on developing on Windows, but the Operators will have a 32" LCD TV as their screen running off of Linux (LinuxMint in particular, so of the Ubuntu/Debian variety).

    ReplyDelete
  2. I know this was written a long time ago, and I've never left a comment before, but thank you so much for posting- never could've figured this out on my own and without the solution I may have stopped pursuing programming altogether. Thanks again!

    ReplyDelete