Q:配置run/debug configuration时 main class 报红,运行后提示“错误: 找不到或无法加载主类 Engine.Runner”;如下图:
运行提示‘错误: 找不到或无法加载主类 Engine.Runner’;修改文件夹为package

A:排查得知,与package有关;main class所在的目录非package;
原因:
1.java指令默认在寻找class文件的地址是通过CLASSPATH环境变量中指定的目录中寻找的。
2.我们忽略了package的影响。

Q:修改main class所在的目录为package;
A:文件夹 右键 --> Mark Directory as --> Source Root运行提示‘错误: 找不到或无法加载主类 Engine.Runner’;修改文件夹为package

参考文章:https://www.cnblogs.com/shea/p/8611346.html
https://blog.csdn.net/liyanlei5858/article/details/77320063

相关文章:

  • 2021-11-17
  • 2021-05-20
  • 2021-11-18
  • 2021-05-16
猜你喜欢
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2021-06-28
  • 2022-02-25
  • 2021-12-23
相关资源
相似解决方案