I am trying to run a bat file to easily run my program. The Batch file is in the folder project folder, along side the bin folder. I have many classes in many different packages. But the main method is in my Game.class which is located in: bin\\xx\\xx\\xxxx\\xxx\\xxxxxx\\cards\\game\\Game.class
So I have set two bat files and tried them both: 1.
java -cp bin\xx\xx\xxxx\xxx\xxxxxx\cards\game Game
2.
java -cp bin.xx.xx.xxxx.xxx.xxxxxx.cards.game Game
Both times I get this error:
Could not find or load main class Game
This makes more sense:
java -cp /path/to/"class-root"/ full.qualified.name.of.Game
...where "/path/to/class-root/" is probably "bin" in your case, and relates to "default package" (no package). From there on the path should be consistent with the package(s) of your class(es)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.