views:

1036

answers:

1

I get the following error message

RobotFace.java:3: package acm.graphics does not exist
import acm.graphics.*; 
^

It suggests me that I do not have acm.graphics -package.

I have tried to find and install the package in MacPorts unsuccessfully by

port search acm

How can you install acm.graphics package in your computer for Java?

+4  A: 

A quick Google search yielded http://jtf.acm.org/.

Note there is a "acm.jar" file. You need to download that and add it to your CLASSPATH.

bdl
How can you put the folder to your CLASSPATH? I put the code unsuccessfully to my .bashrc: export CLASSPATH='$CLASSPATH:/Users/cs/Documents/acm:' . I get the same error as previously.
Masi
You need to add the JAR file to your classpath, not the folder, although technically you can add the folder in Java v6+ using a wildcard "*" char, e.g /usr/local/users/jarfiles/*, which will glob every JAR file in that directory. Since the JAR file is an archive file that contains multiple inner class, manifest and other files, that file added to the classpath will be searched for referenced classes.
bdl
@bdl: Thank you!
Masi