kyonifer / koma

A scientific computing library for Kotlin. https://kyonifer.github.io/koma
Other
270 stars 23 forks source link

Compilation Error in Java #98

Open newbie-gk opened 5 years ago

newbie-gk commented 5 years ago

Hi, I'm getting these warnings\error when trying to use koma in a java project.

Warning:java: unknown enum constant kotlin.annotation.AnnotationRetention.BINARY reason: class file for kotlin.annotation.AnnotationRetention not found Warning:java: unknown enum constant kotlin.annotation.AnnotationTarget.CLASS reason: class file for kotlin.annotation.AnnotationTarget not found Warning:java: unknown enum constant kotlin.annotation.AnnotationTarget.FUNCTION Warning:java: unknown enum constant kotlin.annotation.AnnotationTarget.PROPERTY Warning:java: unknown enum constant kotlin.annotation.AnnotationTarget.CONSTRUCTOR Warning:java: unknown enum constant kotlin.annotation.AnnotationTarget.PROPERTY_GETTER Warning:java: unknown enum constant kotlin.annotation.AnnotationTarget.PROPERTY_SETTER Error:(74, 16) java: cannot access kotlin.jvm.functions.Function0 class file for kotlin.jvm.functions.Function0 not found

I'm new to Kotlin / using kotlin in Java, not sure if I'm doing something wrong. Any guidance is greatly appreciated.

I built the library using the ./gradlew buildJvm and added the jar files to my project library.

As for using it in java: import koma.Koma; <-- this seems fine, no import errors

double[][] distanceMatrix = function assigning value to distanceMatrix

Matrix m = Koma.create(distanceMatrix); <-- this is where the Compilation Error happened

drmoose commented 5 years ago

The classes it can't find are parts of the Kotlin standard library. Since you're not using Kotlin, you'll need to adjust your project's dependencies to include the kotlin standard library manually. If you're using gradle, that looks something like this:

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:1.3.21"
}

More information here in the Kotlin documentation.

If you're using something other than gradle, here is a link to the jar you're missing