0

So I'm watching Stanford's lectures on Programming Methodology and the professor has the code

import acm.graphics.*;
import acm.program.*;

public class HelloProgram extends GraphicsProgram {
    public void run() {
        add( new GLabel("Hello world", 100, 75) );
    }
}

and as far as I can tell the only thing necessary for this to run is to have the acm.jar file loaded in the library.

The only difference between wen he runs that script and when I run mine are that 1) I call my Java file test and so I say that test extends GraphicsProgram, and 2) I'm using NetBeans while he uses Eclipse. Yet when I run this, I get a window that pops up reading, test.Test class wasn't found in Test project. It then asks me to select a main class, but in the options it says <No main classes found>.

I find it confusing for a couple reasons: One is that the code works on his machine, so why not mine? Another is that I had this code working just a couple of days ago, and now all of the sudden it's not, and I have no idea what changed.

Here is my code:

import acm.graphics.*;
import acm.program.*;

public class test extends GraphicsProgram {
    public void run() {
        add( new GLabel("Hello world", 100, 75) );
    }
}
4

0 回答 0