skip to Main Content

I want to run this GitHub java program:
https://github.com/ss2cp/AI-TicketToRide

According to the README.md it should run with src/ttr.main/TTRMain

I am trying to start the game in linux, but I keep on getting the error:

Error: Could not find or load main class src.ttr.main.TTRMain

Caused by: java.lang.ClassNotFoundException: src.ttr.main.TTRMain

I tried

java src.ttr.main.TTRMain
java src/ttr.main/TTRMain
src/ttr.main/TTRMain
java ttr.main.TTRMain
java -jar JGame.jar
java -cp . src.ttr.main.TTRMain
java -cp . ttr.main.TTRMain

from the ~/Downloads/AI-TicketToRide-master/ folder (where the README.md and .classpath file is).
I also tried it from ~/Downloads/AI-TicketToRide-master/bin/ttr/main/ and ~/Downloads/AI-TicketToRide-master/src/ttr/main/

But no luck.

I am using Ubuntu 20.04 and openjdk 11.0.20.1 2023-08-24.

How do I start the program and from which directory? And should I set a classpath?

2

Answers


  1. The class is in the ttr.main package, and named TTRMain. Further, there is a bin folder containing the compiled classes. So, the command you want is to specify the bin folder on your classpath and then the fully qualified class name. Like,

    java -cp bin ttr.main.TTRMain
    
    Login or Signup to reply.
  2. You can maybe use ant to compile and run your code
    try installing ant and then you just write
    ant compile
    ant run

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search