error Class 'com.example.NodeDriverKt' not

2020-04-10 23:59发布

While running a corDapp(corDapp-example) for the first time using Kotlin-source, the IntelliJ throws this error - "error Class 'com.example.NodeDriverKt' not found in module 'cordapp-example". I looked for this class in my project structure and I can see a file named NodeDriver.kt which contains a function "main" but I could not see any class declaration. Any solution to remove this error would be much appreciated.IntelliJ

3条回答
Summer. ? 凉城
2楼-- · 2020-04-11 00:29

i had this same problem with the example cordapp. I was able to resolve this problem by deleting the build and gradle folders in my project, and then, opening the jet brains IDE back again. This restarted the process of installing the gradle. Then the configurations file were set the right way. Previously all the class paths were not there. Have a look on my new configuration of kotlin that was preset after performing the above step. "Use Classpath of module" now is com.example.workflows-kotlin.test =>

Kotlin configuration for running the example cordapp

I hope this helps :)

查看更多
兄弟一词,经得起流年.
3楼-- · 2020-04-11 00:32

Solution 1 : It is a problem centric to 'Caching issue' of IntelliJ IDE. Open menu: File and hit Invalidate Caches / Restart....

Solution 2 : If the problem still persists then remove the gradle folder from the project and close the project and after opening the IDE ,it will setup the gradle again.And it will solve the issue. While debugging the application,now you will be able to see the class path.

查看更多
淡お忘
4楼-- · 2020-04-11 00:35

A Kotlin file called FileName.kt with a main method is compiled into a JVM class called FileNameKt. So the NodeDriverKt class is generated when the Kotlin main method in NodeDriver.kt is compiled into a JVM class.

This appears to be an IntelliJ caching issue. Try deleting the Run Example CorDapp - Kotlin run configuration (even if you are not using it directly to run the driver.

查看更多
登录 后发表回答