OpenJDK with Visual C++

OpenJDK Backwards Compatibility with Windows

The OpenJDK contributors have been working hard to maintain backwards compatibility of Java 8 on older Windows versions. Windows 7 and Server 2008 have seen support until the end of 2020 (with a bit of care and effort the current version could be built to run on XP) but all things see an end as Microsoft has ended support for those version earlier in 2020.

Conservatively using Visual C++ 10 for compiling OpenJDK has been part of this strategy. This may seem counterintuitive to developers trying to be on the leading (and bleeding edge), but for complex C software packages, a compiler version jump is a major quality assurance hassle.

The Visual C(C++) compiler and the corresponding C runtime libraries do not update with every Visual Studio release. Since VS 2015, the compiler is maintained on major version 14.

Impact on the OpenJDK

The most noticeable aspect of this is the bundling of some VC runtime libraries with the OpenJDK. You will find msvcr100.dll or vcruntime140.dll in <JRE>/bin as the Java tools are dynamically linked (while the JVM is statically linked). This helps skipping the “Windows DLL hell” issues.

All versions of VC++ since 10 have been in active maintenance, receiving security and bug fixes when required. Visual Studio 2010/VC++10 has been retired in July 2020, in line with retiring Windows 7/Server 2008 earlier that year.

Visual Studio version Visual C Runtime library
VS 2010 10
VS 2012 11
VS 2013 12
VS 2015 14.x
VS 2017 14.x
VS 2019 14.x

 

Since summer 2020 OpenJDK 8 is slowly switching to VC++14. As VC++10 is still (end of 2020) considered stable and safe, each OpenJDK distribution is making the move at its own pace.

OpenJDK 11 started out with VC++14 from the start, but consequently many distributions only supported it from Server 2012 onward.

On the DLL Hell

Microsoft has been publishing updates to supported versions runtime libraries (e.g. msvcr100.dll and msvcp100.dll) from time to time, but to the dismay of developers and Windows admins those are often lost in the “Windows DLL hell” with little transparency as to when which version was published and where to obtain it.

To obtain the exact version of a DLL use the Powershell command:

  • (Get-Command C:\Path\To\msvc100.dll).FileVersionInfo.FileVersion

You will most likely find up to three versions of VC Runtime libraries in your system, often different ones in the same software package.

Summary

  1. Maintaining backwards compatibility means making compromises, being conservative when updating the compiler. Using the latest tools is a quality assurance challenge and sacrifices platform support.
  2. Old versions of runtime libraries do impact security as long as those runtime libraries are being patched. VC++10 was maintained until July 2020.
  3. The OpenJDK contributors are constantly monitoring all tool and platform changes for impact on the OpenJDK. Security and patch levels of compilers and third-party libraries are constantly being reviewed

Don’t Forget to Share This Post!

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard