[JAVA] I tried to build AdoptOpenJDK 8 (Addition: Amazon Corretto 8)

Trigger

Oracle will charge Java after February (no free Java will be released)

Oracle will not release free Java after February. The government (Cabinet Secretariat Information and Communication Technology (IT) Comprehensive Strategy Office) has announced a policy of using Oracle's paid Java or updating OpenJDK every six months. https://cio.go.jp/sites/default/files/uploads/documents/technique_report_java.pdf

However, both developers and system users

I think. (Developers and users who do not use Java and uninstall it have begun to appear)

Especially for developers and users who maintain rich client applications using Java FX and Java Web Start, upgrading to Java 11 is not immediately acceptable.

There is AdoptOpenJDK / Amazon Corretto

There is support. I thought it would be a good idea to use these.

AdoptOpenJDK 8 / Amazon Corretto 8 has a bug

When I proceeded with the verification, I found a bug that does not occur in OracleJDK 8 but occurs in AdoptOpenJDK 8 / Amazon Corretto 8. Specifically, even if the characters are rotated, the Japanese characters are not rotated.

Let's fix it

I actually moved my hand. I was able to do it quickly on Linux, and I had trouble building on Windows, so I will describe building on Windows.

work

Preparation

Installing Visual Studio Express 2013

https://visualstudio.microsoft.com/ja/vs/older-downloads/ Download from.

There was a direct link URL on the Microsoft bulletin board, but it is unknown how long it will be available for download. http://download.microsoft.com/download/E/F/2/EF21D164-8A66-4F08-B71F-26702B180E11/VS2013_RTM_DskExp_JPN.iso

Please install it after downloading. There are almost no choices, just install it obediently.

After Visual Studio 2015, use the build preparation script (generated-configure.sh)

So please select Visual Studio 2013. With Visual Studio 2013 Express, there is no problem with corporate use.

Install Cygwin

https://cygwin.com/install.html Download the 64-bit version (setup-x86_64.exe) from.

Once downloaded, run and set up. I think that the "Choose Download Site" on the way will end early if you choose a Japanese http site. The packages to be added are as follows.

Download JDK7

You also need the JDK to build. It is standard to use the stable JDK of the previous version, so this time I will download and install JDK 7 of Oracle. https://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html

You may copy the JDK 7 included with Pleiades etc. In this article D:\OpenJDK\jdk7 I copied the JDK to.

Freetype download

Freetype is a font drawing library. Required to build the Adopt OpenJDK. (It is included in OpenJDK 11 and seems unnecessary.)

You can build from source, but this time we will get the pre-built one. ~~ I am using Visual Studio 2013, so download vc12 64bit. https://www.opencascade.com/content/3rd-party-components~~

The latest version of the binary for Windows is below https://github.com/ubawurinna/freetype-windows-binaries

git clone https://github.com/ubawurinna/freetype-windows-binaries You can also get the zip file.

In this article, the acquired files are listed. D:\OpenJDK\freetype I copied it below.

The configuration under freetype is

I think it is. If you want to make a 64-bit JDK, rename win64 to lib for build

Build

Get source code

Launch Cygwin64 Terminal.

You can get the source code of each.

Source code modification

~~ It turned out that the problem that the characters are not rotated, which is the problem this time, seems to have already been fixed in OpenJDK9. https://bugs.openjdk.java.net/browse/JDK-8163278?focusedCommentId=13999670&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13999670 Patch on the above page https://bugs.openjdk.java.net/secure/attachment/63104/jdk9.patch I will try to reflect it obediently. Where to fix AdoptOpenJDK8 openjdk-jdk8u/jdk/src/share/native/sun/font/freetypeScaler.c is. ~~

It has already been fixed in JDK 11's freetypeScaler.c and backports this code. https://github.com/AdoptOpenJDK/openjdk-jdk11u/commit/f1bf238b695e0b4d49b8264b83228317ee75ebd3#diff-5c6198e34c46737fc7bf8f0eb5fff8d0

JDK11 freetypeScaler.c jdk/src/share/native/sun/font/freetypeScaler.c Overwritten on.

Build

configure

Execute the following command at. bash configure --with-boot-jdk=/cygdrive/d/OpenJDK/jdk7 --with-freetype=/cygdrive/d/OpenJDK/freetype --disable-debug-symbols --disable-zip-debug-info

--with-boot-jdk The location of the JDK --with-freetype Specifies the location of freetype.

--disable-debug-symbols --disable-zip-debug-info You can delete the debug information and reduce the file size of the resulting JRE / JDK by adding

configure trap

At first, even if I did configure according to the above command, it didn't work.

I was thinking that "generated-configure.sh" was buggy, but suddenly I noticed a trap in the Windows file path.

In Windows, it is not necessary to escape with a backslash even if there is a space in the file path, but in Linux etc. it is necessary to escape. So, generated-configure.sh intentionally used the abbreviated file name of Windows, and devised not to handle half-width spaces. However, it seems that there are cases where the abbreviated file name is not created (from a version in the middle of Windows 10?).

I found it by checking "dir / x" at the command prompt. fsutil file setshortname "Microsoft Visual Studio 12.0" MICROS~2 After registering the abbreviated name with the command, I was able to finish configure safely. dirx.png

make

At make images given that, build/windows-x86_64-normal-server-release/images/j2re-image The image of JRE build/windows-x86_64-normal-server-release/images/j2sdk-image The image of the JDK is created in.

make images COMPRESS_JARS=true You can then compress the generated image and reduce the file size.

result

Although it looks a little different from Oracle, we were able to fix the character rotation bug.

I think that the difference in appearance is due to the difference in the font drawing library (FreeType or F2T). https://github.com/AdoptOpenJDK/openjdk-build/wiki/Differences-between-Adopt-OpenJDK-binaries-and-Oracle-JDK-Binaries

Serpentine

Adopt OpenJDK or Amazon Corretto

AdoptOpenJDK is sponsored by many companies, and IBM and Microsoft are the strengths. https://adoptopenjdk.net/sponsors.html

Amazon Corretto is sensational, but so far it is only supported by one Amazon company and may be locked on to AWS. Pay attention to future developments.

Through this work ...

I've just backported the already published patches to Adopt OpenJDK 8 / Amazon Corretto 8, but open source is great, considering that it might be useful to someone else in the world. Thank you to Oracle for giving me this opportunity!

Recommended Posts

I tried to build AdoptOpenJDK 8 (Addition: Amazon Corretto 8)
I tried to build AdoptOpenjdk 11 on CentOS 7
I tried to build Ruby 3.0.0 from source
I tried to verify AdoptOpenJDK 11 (11.0.2) with Docker image
I tried to build Micra mackerel in 1 hour!
I tried to build an environment using Docker (beginner)
I tried to verify yum-cron
I tried to build the environment little by little using docker
I tried to build the environment of WSL2 + Docker + VSCode
I tried to summarize iOS 14 support
I tried to interact with Java
I tried to explain the method
I tried to summarize Java learning (1)
I tried to understand nil guard
I tried to summarize Java 8 now
I tried to chew C # (polymorphism: polymorphism)
I tried to explain Active Hash
I tried to build the environment of PlantUML Server with Docker
I tried to build an http2 development environment with Eclipse + Tomcat
I tried to build a simple application using Dockder + Rails Scaffold
I tried to build a laravel operating environment while remembering Docker
I tried to summarize the methods used
I tried to introduce CircleCI 2.0 to Rails app
I tried migrating Processing to VS Code
I tried to summarize Java lambda expressions
I tried to get started with WebAssembly
I tried to solve AOJ's Binary Search
I tried to build a Firebase application development environment with Docker in 2020
01. I tried to build an environment with SpringBoot + IntelliJ + MySQL (MyBatis) (Windows10)
I tried to implement the Iterator pattern
I tried to summarize the Stream API
What is Docker? I tried to summarize
I tried to use Selenium like JQuery
I tried to touch JavaScript Part.2 Object-oriented
I tried to implement ModanShogi with Kinx
I tried to summarize about JVM / garbage collection
Try to build Java8 environment on Amazon Linux2
I tried to make Basic authentication with Java
I tried to implement polymorphic related in Nogizaka.
I tried to manage struts configuration with Coggle
[Rails] I tried to raise the Rails version from 5.0 to 5.2
I tried to manage login information with JMX
java I tried to break a simple block
I tried to link grafana and postgres [docker-compose]
I tried to develop a man-hour management tool
I tried to develop a DUO3.0 study website.
I tried to chew C # (basic of encapsulation)
[Must see !!!] I tried to summarize object orientation!
I tried to create a LINE clone app
[Ruby basics] I tried to learn modules (Chapter 1)
I tried to output multiplication table in Java
I tried to link JavaFX and Spring Framework.
I tried to set tomcat to run the Servlet.
I tried to develop an application in 2 languages
I tried to create Alexa skill in Java
I tried to develop a website to record expenses.
I tried to implement a server using Netty
I tried to break a block with java (1)
I tried tomcat
I tried youtubeDataApi.
I tried refactoring â‘