# How to use Kotlin native to compile a kotlin file which imports third party package

**URL:** <https://discuss.kotlinlang.org/t/how-to-use-kotlin-native-to-compile-a-kotlin-file-which-imports-third-party-package/29784>\
**Category:** Native\
**Created:** [January 23, 2025, 8:46am UTC](https://discuss.kotlinlang.org/t/how-to-use-kotlin-native-to-compile-a-kotlin-file-which-imports-third-party-package/29784 "2025-01-23T08:46:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Song\_Zhang.jrfj](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@Song\_Zhang.jrfj](https://discuss.kotlinlang.org/u/Song_Zhang.jrfj)\
**Post date:** [January 23, 2025, 8:46am UTC](https://discuss.kotlinlang.org/t/how-to-use-kotlin-native-to-compile-a-kotlin-file-which-imports-third-party-package/29784/1 "2025-01-23T08:46:16Z")

</div>

I have a Kotlin file

```auto
import kotlinx.datetime.Clock
fun currentTime(): Long {
    return Clock.System.now().toEpochMilliseconds()
}

```

However, `kotlinx.datetime.Clock` is from third party library. How can I pass the library `libs.kotlinx.datetime` to kotlin native compiler without using gradle?

---

<div class="post-metadata">

**Author:** ![Skater901](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/skater901/32/10163_2.png) [@Skater901](https://discuss.kotlinlang.org/u/Skater901)\
**Post date:** [January 23, 2025, 9:02am UTC](https://discuss.kotlinlang.org/t/how-to-use-kotlin-native-to-compile-a-kotlin-file-which-imports-third-party-package/29784/2 "2025-01-23T09:02:17Z")

</div>

It depends if `kotlinx.datetime.Clock` is coming from a Java library, or a Kotlin library, or a Kotlin native library. If it’s a Java/Kotlin library, the answer is that you can’t use it (unless you have the source code). Such libraries are published to places like Maven Central as Java Byte Code. The Kotlin native compiler doesn’t handle Java Byte Code (last I knew), because there are existing tools out there to do that, like GraalVM.

If it’s a Kotlin Native library, then apparently you can use a command-line argument to pass the library to the compiler: [Kotlin compiler options | Kotlin Documentation](https://kotlinlang.org/docs/compiler-reference.html#library-path-l-path)
