简体   繁体   English

Java ACM包

[英]Java ACM package

I'm trying to write a java application in Eclipse. 我正在尝试在Eclipse中编写一个java应用程序。

I'm really wanting to use the ACM.Program package, however, my copy of Eclipse doesn't have it installed! 我真的想要使用ACM.Program包,但是,我的Eclipse副本没有安装它!

I've looked all over the net, and I can't find a single download for the ACM package. 我看了整个网络,我找不到ACM包的单一下载。

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". 我在ying-yang上下错误,都暗示没有“acm.program”这样的东西。

Anyways, I need to know where to find the ACM package, and, how to install it. 无论如何,我需要知道在哪里可以找到ACM包,以及如何安装它。

Thanks! 谢谢!

--Flynn --Flynn

You can download acm.jar from the ACM Java Task Force and then add it to your classpath . 您可以从ACM Java Task Force下载acm.jar ,然后将其添加到类路径中

It appears that the previous link is dead. 看来上一个链接已经死了。 The files are still available at Eric Roberts' Stanford page . 这些文件仍然可以在Eric Roberts的斯坦福页面上找到

The general answer is: 一般答案是:

  1. Download the JAR files from the relevant site 从相关站点下载JAR文件
  2. Copy (or import) them into your Eclipse project. 将它们复制(或导入)到Eclipse项目中。 People often put external JARs into a lib directory, but that's just a personal choice. 人们经常将外部JAR放入lib目录,但这只是个人选择。
  3. Add them to the project's build path. 将它们添加到项目的构建路径中。

However, I wouldn't recommend using the "ACM" classes. 但是,我不建议使用“ACM”类。 They were an interesting idea, but they didn't catch on. 他们是一个有趣的想法,但他们并没有流行起来。

如果您遵循斯坦福课程,您可以直接将作业(.zip文件)导入新的Java项目。

jtf.acm.org他们让你在那里下载它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM