RFR: 8240197: Cannot start JVM when $JAVA_HOME includes CJK characters

Yasumasa Suenaga suenaga at oss.nttdata.com
Fri Feb 28 01:54:50 UTC 2020


Hi all,

Please review this change:

   JBS: https://bugs.openjdk.java.net/browse/JDK-8240197
   webrev: http://cr.openjdk.java.net/~ysuenaga/JDK-8240197/webrev.00/

JVM cannot start as below when CJK characters are included in $JAVA_HOME.

```
PS > .\build\windows-x86_64-server-fastdebug\images\jdk日本語\bin\java.exe --version
Error occurred during initialization of VM
Failed setting boot class path.
```

I think this bug has been occurred since JDK-8191521.
It uses mbstowcs_s() to convert char* to wchar_t*. But Windows API for wchar_t* (they are named *W()) requires Unicode chars for their arguments. mbstowcs_s() would not convert to Unicode. We need to use MultiByteToWideChar().

This issue has been also confirmed in AdoptOpenJDK 11.0.6 [1]. So we also need to change jdk11u.

I tested this change on submit repo, then it was failed (mach5-one-ysuenaga-JDK-8240197-20200228-0138-9049982).
However the error was not caused by this change because it was occurred in all platforms in spite of I changed for Windows only.
(Of course, it works well on my Windows 10 laptop.)

I'm happy if you help to investigate cause of error.


Thanks,

Yasumasa


[1] https://github.com/AdoptOpenJDK/openjdk-build/issues/1496


More information about the hotspot-runtime-dev mailing list