JEP proposed to target JDK 10 (2017/11/27)

Johan Vos johan.vos at gluonhq.com
Mon Dec 4 09:06:13 UTC 2017


Regarding JEP 313 (removing javah): I'm all in for using javac -h instead
of javah so I think this is a good thing.

However, there is 1 usecase that I ran into last week:
Somewhere in OpenJFX, native code required access to constants in
java.lang.Character. This was previously done by running javah on
Character.class which generated the header file containing the constants.
Since javac works on source files, this approach doesn't work anymore (the
source of Character.java is not in OpenJFX).

A workaround is to have a class in OpenJFX that references the constants
from Character, and then run javac -h on that class.

I consider that workaround sufficient, so removing javah won't make it
impossible to achieve this (maybe unconventional) goal of leveraging Java
constants in native code that has no direct access to the source of the
class containing the constants.

- Johan


More information about the jdk-dev mailing list