I am trying to run the following script - source of code here- on my terminal:
import acm.program.*;
public class Add2 extends Program {
public void run() {
println("This program adds two numbers.");
int n1 = readInt("Enter n1: ");
int n2 = readInt("Enter n2: ");
int total = n1 + n2;
println("The total is " + total + ".");
}
}
I then compile and run the code using these two steps on my terminal:
javac -classpath acm.jar Add2.java
java Add2
The compilation indicates no errors , but when I try to run the script, I get the following error:
Error: Could not find or load main class Add2
.
I'm fairly new at working with Java so any advice on how to make this work would be greatly appreciated!