When pre-built binary packages don't meed your needs, it pays to consider ways to build what you need from source via FreeBSD's extensive ports system.
Some FreeBSD ports support a
make config target that allows you to select from various dependency options, but alas,
tomcat9 doesn't have many configuration knobs that one can tweak.
FreeBSD ports also support the
make missing target to tell you what required ports or packages aren't already installed. For convenience, I will sort the
# cd /usr/ports/www/tomcat9
# make missing | sort
Let's look at the
devel/jakarta-commons-daemon dependency and do the same thing there:
# make -C ../../devel/jakarta-commons-daemon missing | sort
Close inspection of those lists shows that
devel/jakarta-commons-daemon is the only entry not in both lists.
In other words, tomcat9 has only one (missing) dependency:
devel/jakarta-commons-daemon itself. All the other missing bits of
tomcat9 are in fact dependencies of
devel/jakarta-commons-daemon. So your question becomes, "How can I build the port for
devel/jakarta-commons-daemon using jdk12 instead of the default jdk8?" A question I can't answer, to be sure, but I hope you will get some benefit from having a more precisely targeted question.
FreeBSD has a java-specific mailing list. You can sign up here. A clear, documented question that shows research and effort is most likely to get a response. That is where I'd wager you are most likely to find someone who knows the answer to your question. If you do find out, please come back here and post it as an answer, so that future StackExchange readers can benefit from your efforts.
You may also be interested in adding your email as a CC: on this FreeBSD Bugzilla entry to stay abreast of development work to improve support for recent versions of the Java Development Kit.