Class not found in module
Class not found in module
I made a project using kotlin:
Group id-> com.programming.kotlin
Artifact id->chapter01
Module name->chapter01
package->com.programming.kotlin.chapter01
I made a kotlin class called Program.kt
The problem is: when i try to make a new class(called Program2.kt) inside package and when i try to run it ,i got this error:
class com.programming.kotlin.chapter01.Program2kt not found in module 'chapter01_main'
My question is:
how to allow any new class other than Main class to run inside intellij ?
package com.programming.kotlin.chapter01
Program2.kt
yes,it's included
– Mohamed Amin
Jul 5 '17 at 23:30
The is obviously something wrong with your classpath. Please add some more information: Gradle-script, how you run the application, how you build the application.
– guenhter
Jul 6 '17 at 5:22
try to invalidate and restart
– A.N.T
Jul 6 '17 at 22:56
hey author did you solved that issue?
– Nimish Bansal
Jan 26 '18 at 15:04
1 Answer
1
Your class name should be com.programming.kotlin.chapter01.Program2
. If you go to InteliJ and right click on the class, you can click Copy Reference
, which will copy the class reference (package and class name).
com.programming.kotlin.chapter01.Program2
Copy Reference
The Kt (with a capital K) is only added to functions without an enclosing class or object.
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy
Did you include
package com.programming.kotlin.chapter01
intoProgram2.kt
?– hotkey
Jul 5 '17 at 22:54