0

I am just getting started with Java and Eclipse and I ran across a problem. I copied a program as part of a YouTube class to create a checkerboard. It runs as an applet but not as an application. When I try to run as an application I get:

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)

Below is the code:

/* 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);
            }
        }
    }
}

Thanks!

2 Answers 2

2

You are trying to load a 32-bit DLL into a 64-bit processor.

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) 

Looking at the error, your JVM is 64-bit but the DLL GCMDLN.DLL is buit for 32-bit processor. you can either,

  • Get a 64-bit GCMDLN.DLL, or
  • Install and use 32-bit JVM with your GCMDLN.DLL
Sign up to request clarification or add additional context in comments.

Comments

1

Applets have different lifecycle methods, that is - they do not start by an invocation of a main(), and so you won't be able to run it through an IDE, at least not just by clicking run.

In Eclipse, right click your project, try Run Configurations > Run as Applet.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.