Reputation: 31
import acm.graphics.*;
import acm.program.*;
public class HelloProgram extends GraphicsProgram {
public void run() {
add(new GLabel("hello, world"), 100, 75);
}
}
I learned this code on http://people.reed.edu/~jerry/121/materials/artsciencejava.pdf page 23. However , when I run it in Eclipse , it shows many errors. It said I can't import cam.graphics.* and so on. Can anyone tell me what to do ? Thanks so much!!!!
Upvotes: 0
Views: 1007
Reputation: 285403
You haven't added the appropriate external libraries to Eclipse's build path. Do you have the acm jar files? If so, right click on your project and add the library paths to your build path.
After clicking on Build Path, then click on Add External Archives...
Note, I've made this answer a Community Wiki so that I won't benefit from up-votes and so all can edit and improve this answer.
Upvotes: 4
Reputation: 325
Download the java library that he is using here:
Then add the library to your build path as described here:
http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)
Upvotes: 1
Reputation: 425003
acm.jar
into a folder on your computer (perhaps one near your project files)Upvotes: 0