I'm trying to compile and run a class TestBot1 that extends a class in a JAR. It compiles fine, but when I run it I get 'Error: Could not find or load main class TestBot1'.
Here's an MWE. TestBot1.java:
import bwapi.*;
public class TestBot1 extends DefaultBWListener
{
public static void main(String[] args)
{
System.out.println("It works!");
}
}
I execute both the compile and the run command in the same directory as TestBot1.java (and TestBot1.class when it generates). I compile with:
javac TestBot1.java -classpath .;../lib/bwmirror_v2_5.jar
I attempt to run with:
java TestBot1 -classpath .;../lib/bwmirror_v2_5.jar
As is evident from the above, my directory structure is as follows:
Folder TestBot1 contains folders src and lib; src contains TestBot1.java, and lib contains bwmirror_v2_5.jar.
This run fails with a 'could not find or load main class' error. If I remove 'extends DefaultBWListener', though, everything compiles and runs fine. I'm on Windows 7, using Java 1.8.0
I'm not a Java expert, and most of my experience building large codebases is with C/C++/Fortran and make. I understand that I could just use Eclipse. I'd like to figure out my misunderstanding here, though.