https://kotlinlang.org logo
#getting-started
Title
# getting-started
e

enshahar

09/23/2021, 1:42 AM
Hi everyone, I tried to use 
<http://kotlin.io|kotlin.io>.path.createTempDirectory()
 to create temporary directory on my kotlinc 1.4.31 but failed on Windows, WSL2 and Mac. In the Kotlin playground web,  the code raises `SecurityException`(which is correct) but all my systems (including kotlinc and intelliJ IDEA) cannot resolve the package 
kotlin.io.path
 . Is there anything I need to do to use the 
kotlin.io.path
 package?
e

ephemient

09/23/2021, 1:56 AM
are you targeting jvm 8? (should be the default now, https://kotlinlang.org/docs/whatsnew15.html#new-default-jvm-target-1-8 but checking just in case)
e

enshahar

09/23/2021, 6:06 AM
I'm using JVM 16. Anyway, I found the reason. The extensions are available in the 
kotlin-stdlib-jdk7
 module. So I need to put the jar file to the classpath or add the dependency to
kotlin-stdlib-jdk7
or `kotlin-stdlib-jdk8`(which transitively depends on the
kotlin-stdlib-jdk7
).
e

ephemient

09/23/2021, 11:22 AM
the jdk used to compile does not have to match the compilation target jvm
Kotlin plugin should be automatically adding stdlib-jdk7/-jdk8 based on the target, so it still sounds like something is going wrong with your setup. any public repro?
2 Views