I have a file called A.kt which has dependencies on B.jar. How to compile and run the kotlin file on CLI?
I have tried:
kotlinc A.kt -cp B.jar
but this did not work.
The error I get is:
A.kt:11:24: error: unresolved reference: B
val b = B(
Running
kotlinc -helpshows:That puts the options before the source files. Which is pretty standard: most commands process their arguments in order, so I'd expect the command in the question to compile
A.ktbefore setting up the classpath to includeB.jar.So you should try:
Other potential causes include
B.jarnot being present in the current directory (or not being given along with the necessary path info), and it not containing the relevant.classfiles (in directories corresponding to their packages).