Compiling jdk8 packages with kotlinc -- packages cannot be imported error | java.time

I am trying to compile a simple kotlin program (provided below; which uses the jdk8 package ‘java.time’) using the kotlin command line compiler - kotlinc.
I get the package cannot be imported error.


import java.time
fun main(args: Array<String>) {}

Command Line
kotlinc Program.kt -include-runtime -d p.jar

error: packages cannot be imported
import java.time

“C:\Program Files\Java\jdk1.8.0_131”

The error says:

cannot import packages

Perhaps you should try:

import java.time.*
1 Like

It works, cannot believe I made such a mistake.

I made the same mistake. I thought the import mechanism works like in Python.
P.S. Did not learn Java before.