Reputation: 1767
I'm using kotlin on command line and I'm getting import
errors error: unresolved reference: ConnectionHandler
Following is my directory tree:
$ tree .
.
├── LICENSE
├── main.jar
├── main.kt
└── server
├── ConnectionHandler.class
├── ConnectionHandler.kt
├── HttpRequest.class
└── HttpRequest.kt
1 directory, 7 files
When I run kotlinc main.kt -include-runtime -d main.jar
I get
main.kt:2:8: error: unresolved reference: server
import server.*
I have declared package server
in both of server/ConnectionHandler.kt
and server/HttpRequest.kt
Note: The
META-INF
folder is missing. It is not regenerated either on subsequent compilations.
What am I doing wrong? If it has anything to do with META-INF
folder, how can I regenerate it?
Upvotes: 0
Views: 2654
Reputation: 2945
You need to include all your source files when using kotlinc (or at least include the compiled classes on the classpath). e.g.
kotlinc main.kt server/ConnectionHandler.kt server/HttpRequest.kt -include-runtime -d main.jar
Upvotes: 1