Question:
Hi! I’m hoping for help with understanding and fixing my code or files. I am trying to create an assignment for students to use that utilizes static graphics through the acm package. I have uploaded an acm.jar file but when I try to run the file, it gives me errors. Repl link: https://replit.com/@AmyWang51/Graphics-Starter-Code#MyProgram.java
This is all the code I have in my MyProgram.java.
import acm.program.*;
import acm.graphics.*;
import acm.util.*;
import java.util.*;
import java.io.*;
import java.awt.*;
public class MyProgram extends GraphicsProgram {
public void run(){
GRect hi = new GRect(50,50,50,50);
add(hi);
}
}
When I run it, I get the following errors:
./MyProgram.java:9: error: cannot find symbol
public class MyProgram extends GraphicsProgram {
^
symbol: class GraphicsProgram
./MyProgram.java:1: error: package acm.program does not exist
import acm.program.*;
^
./MyProgram.java:2: error: package acm.graphics does not exist
import acm.graphics.*;
^
./MyProgram.java:3: error: package acm.util does not exist
import acm.util.*;
^
./MyProgram.java:11: error: cannot find symbol
GRect hi = new GRect(50,50,50,50);
^
symbol: class GRect
location: class MyProgram
./MyProgram.java:11: error: cannot find symbol
GRect hi = new GRect(50,50,50,50);
^
symbol: class GRect
location: class MyProgram
Thank you Windlother! I tried doing that but still received the same errors. Maybe this context might be helpful:
I forked this Replit from a former colleague (another teacher), so I’m not familiar with how the files all work. I see a .replit file AND a .replit.backup file.