5

I'm trying to write a java application in Eclipse.

I'm really wanting to use the ACM.Program package, however, my copy of Eclipse doesn't have it installed!

I've looked all over the net, and I can't find a single download for the ACM package.

More info: Whenever I try the code:

package helloGeiodo;
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 get errors up and down the ying-yang, all implying that there is no such thing as "acm.program".

Anyways, I need to know where to find the ACM package, and, how to install it.

Thanks!

--Flynn

Robin Green
  • 32,079
  • 16
  • 104
  • 187
Georges Oates Larsen
  • 6,812
  • 12
  • 51
  • 67

4 Answers4

8

You can download acm.jar from the ACM Java Task Force and then add it to your classpath.

It appears that the previous link is dead. The files are still available at Eric Roberts' Stanford page.

superdesk
  • 1,162
  • 11
  • 24
ide
  • 19,942
  • 5
  • 64
  • 106
4

The general answer is:

  1. Download the JAR files from the relevant site
  2. Copy (or import) them into your Eclipse project. People often put external JARs into a lib directory, but that's just a personal choice.
  3. Add them to the project's build path.

However, I wouldn't recommend using the "ACM" classes. They were an interesting idea, but they didn't catch on.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • @GeorgesOatesLarsen - Teaching (and using) standard Java SE classes – Stephen C Aug 07 '13 at 22:53
  • I would agree on their usage but you could learn a lot by just browsing it's source code also as it is available at http://www-cs-faculty.stanford.edu/~eroberts/jtf/ as the acm.zip – Douglas G. Allen Nov 29 '13 at 22:52
  • 1
    @DouglasG.Allen - Java SE library source code is also available. Partial source code has *always* been available to programmers for free, and since Java 6 the entire codebase is available. Frankly, if people want to read code, the Java SE code is more relevant. – Stephen C Nov 30 '13 at 01:58
1

If you follow the Stanford courses, you can import the Assignment directly (.zip files) into a new Java project.

A_rnO
  • 141
  • 1
  • 5
0

jtf.acm.org They let you download it there.