Appreciate to @liaifat85 gave me a big hint and it solved my issue.
Instead of using the -jar option, you can try the -cp option for both JAR files and specify the main class explicitly.
java -cp Library.jar:MyCode.jar MyCodeKt