
[英]JavaFX Error : Could not find or load main class home.main with gradle (IntelliJ) when I try to run my jar file
[英]In an IntelliJ Kotlin project, when I try to run a java class, I get a "Could not find or load main class" error
您的 java 代码需要放在src/main/java
目录而不是src/main/kotlin
。
Kotlin compiler doesn't compile Java files in Kotlin source roots, Java compiler doesn't compile Java files in Kotlin source roots, therefore '.class' files are not created by any of the compilers and you get this error.
解决方案是将*.java
文件移动到src/main/java
目录中。 如果此目录不存在,请手动创建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.