Search code examples
javafilekotlindirectorypath

How to get the current working directory in Kotlin?


I need to know the full path of my current working directory of my simple application using Kotlin.


Solution

  • This will provide the full absolute path from where application will run.

    import java.nio.file.Paths
    
    val path = Paths.get("").toAbsolutePath().toString()