'main' method not found


#1
fun <T> bubbleSort(a : Array<T>, c: Comparator<T>) {
    var changed : Boolean
    do {
        changed = false
        for (i in 0 .. a.size - 2) {
            if (c.compare(a[i], a[i + 1]) > 0) {
                val tmp = a[i]
                a[i] = a[i + 1]
                a[i + 1] = tmp
                changed = true
            }
        }
    } while (changed)
}

error: ‘main’ method not found in class SortKt
Please help to solve this error in Kotlin through command line.


#2

If the above code is everything you have in Sort.kt file then there would be no ‘main’ method in class SortKt after compilation. How exactly are you trying to run this code?