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 ?






Did you include package com.programming.kotlin.chapter01 into Program2.kt?

– hotkey
Jul 5 '17 at 22:54


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

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)