0

I have a java project written in kotlin. main class is in kotlin. I have some JNI calls from different file of the projects. The problem is, I need to call the main class, which is written in kotlin from command line. Here is the command that I am using:

/Java/jre/bin/java -cp /app/cs/production/project/ com.test.project.Main u=$123 p=$123 host=$123 appimgv=$imgversion nocfg &

It generates this error:

#Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/TypeCastException
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
        at java.lang.Class.getMethod0(Class.java:3018)
        at java.lang.Class.getMethod(Class.java:1784)
        at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: kotlin.TypeCastException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

What am I doing wrong over here? It works perfectly if I use java codes for main class with the extension .java to the main file. It just does not work with .kt

mAyA
  • 66
  • 6

0 Answers0