我刚刚开始使用 Java 和 Eclipse,但遇到了一个问题。我复制了一个程序作为 YouTube 课程的一部分来创建棋盘。它作为小程序运行,但不作为应用程序运行。当我尝试作为应用程序运行时,我得到:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Clay\GCMDLN.DLL: Can't load IA 32-bit .dll on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at acm.program.DOSCommandLine.getCommandLine(Program.java:2268)
at acm.program.Program.getCommandLine(Program.java:1477)
at acm.program.Program.main(Program.java:1207)
下面是代码:
/* File CheckerBoard.java
* ----------------------
* This program creates a checkerboard
*/
import acm.graphics.*;
import acm.program.*;
/* This class draws a checkerboard on the graphics window.
* The size of the checkerboard is determined by the
* constants NROWS and NCOLUMNS, and the checkerboard fills
* the verticle space available.
*/
public class CheckerBoard extends GraphicsProgram {
/* Number of rows */
private static final int NROWS = 8;
/* Number of columns */
private static final int NCOLUMNS = 8;
/* Runs the program */
public void run() {
int sqSize = getHeight() / NROWS;
for (int i = 0; i < NROWS; i++) {
for (int j = 0; j < NCOLUMNS; j++)
{
int x = j * sqSize;
int y = i * sqSize;
GRect sq = new GRect (x, y, sqSize, sqSize);
sq.setFilled(((i + j) % 2) != 0);
add (sq);
}
}
}
}
谢谢!