I believe this to be a better way to do it as it only needs one single link to be created, no file edits needed, no exports or running of source before an application is run. And no bashrc lines needed.
That said, if you upgrade it may cause unintentional errors to future java releases as it might load an outdated library, although one link removal also solves this.
This works under ubuntu 18.04 with java 11 opensdk installed.
$ locate libjawt.so
$ java -XshowSettings:properties
From the two commands above, you can find the two paths you need to adjust this to your own system.
sudo ln -s /path/from/locate/libjawt.so /path/from/properties/libawt.so
I made a symlink for java ll open sdk to find the library and mine was as follows because /usr/lib is one of the paths in the output. There is (in my output) a java path you may choose to use instead of /usr/lib if you want to keep java library (even symlinks) together.
sudo ln -s /usr/lib/jvm/java-11-openjdk-amd64/lib/libjawt.so /usr/lib/libjawt.so