Call FontAwesomeFX from Kotlin

I have a kotlin app that uses tornadoFX(via maven). I would like to use FontAwesomeFX library to get icons but this library is compiled with newer JDK than kotlin uses. I tried to set target jvm level in kotlin maven plugin to different versions but I am still getting

Exception in thread “main” java.lang.UnsupportedClassVersionError: de/jensd/fx/glyphs/fontawesome/demo/FontAwesomeIconsDemoAppKt has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Is there a way to fix this issue?

You are confusing runtime version with compilation version. You can just use newer JDK to compile project. Be warned though that tornadofx uses some nasty hacks not allowed in JDK 9+, so some things could stop working. We are all waiting for proper Java 11 release.

What is the proper way to do it in maven with kotlin? do I need to add maven compiler plugin?

Did not work with maven for a long time. It is not build config, it is JDK version it runs on top of it. If you have only JDK 8 in your machine, you can’t use it to work with Java 9 class files (version 53). So you need to install additional JDK and use it for the project.