gpt4 book ai didi

Java 程序不会在 Eclipse 中作为应用程序运行

转载 作者:行者123 更新时间:2023-12-01 23:40:21 26 4
gpt4 key购买 nike

我刚刚开始使用 Java 和 Eclipse,遇到了一个问题。我复制了一个程序作为 YouTube 类(class)的一部分来创建棋盘。它作为小程序运行,而不是作为应用程序运行。当我尝试作为应用程序运行时,我得到:

线程“main”java.lang.UnsatisfiedLinkError中出现异常:C:\Users\Clay\GCMDLN.DLL:无法在 AMD 64 位平台上加载 IA 32 位 .dll
在 java.lang.ClassLoader$NativeLibrary.load( native 方法)
在 java.lang.ClassLoader.loadLibrary1(来源未知)
在 java.lang.ClassLoader.loadLibrary0(来源未知)
在 java.lang.ClassLoader.loadLibrary(来源未知)
在 java.lang.Runtime.load0(来源未知)
在 java.lang.System.load(来源未知)
在 acm.program.DOSCommandLine.getCommandLine(Program.java:2268)
在 acm.program.Program.getCommandLine(Program.java:1477)
在 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);
}
}
}
}

谢谢!

最佳答案

您正尝试将 32 位 DLL 加载到 64 位处理器中。

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)

查看错误,您的 JVM 是 64 位,但 DLL GCMDLN.DLL 是为 32 位 处理器构建的。你可以,

  • 获取 64 位 GCMDLN.DLL,或
  • 通过 GCMDLN.DLL 安装并使用 32 位 JVM

关于Java 程序不会在 Eclipse 中作为应用程序运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18049203/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com