[英]Error in running Scala Program: Main method not found in class main, please define the main method
[英]Running java program through cmd ERROR: no main method found
我正在尝试运行bat文件以轻松运行我的程序。 批处理文件位于bin文件夹旁边的文件夹项目文件夹中。 我在许多不同的包中有很多课程。 但是主要方法是在我的Game.class中,它位于:bin \\ xx \\ xx \\ xxxx \\ xxx \\ xxxxxx \\ cards \\ game \\ Game.class
因此,我设置了两个bat文件并对其进行了尝试:1。
java -cp bin\xx\xx\xxxx\xxx\xxxxxx\cards\game Game
2。
java -cp bin.xx.xx.xxxx.xxx.xxxxxx.cards.game Game
两次我都收到此错误:
找不到或加载主类游戏
这更有意义:
java -cp /path/to/"class-root"/ full.qualified.name.of.Game
...在您的情况下,“ / path / to / class-root /”可能是“ bin”,并且与“默认程序包”(无程序包)相关。 从那里开始,路径应与您的课程包一致
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.