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) );
    }
}
Addem
  • 3,635
  • 3
  • 35
  • 58
  • show your code, not his – CharlieS Nov 07 '14 at 02:37
  • It's identical except for the file/class name--any problem with this code should be the same as the problem with mine. But if you must see the change in the class name, I'll put it up. – Addem Nov 07 '14 at 02:39
  • it's looking for `Test`, not `test`. How do you call the run method? – CharlieS Nov 07 '14 at 02:42
  • F6, or clicking `Run > Run Project`. Just an hour ago I switched the class and file names from `Test` to `test` because it was giving me the same error when I did that--not sure why the change didn't fix that. – Addem Nov 07 '14 at 02:46
  • in Eclipse you would need to update the project after changing file name. maybe similar in netbeans? something to force complete rebuild – CharlieS Nov 07 '14 at 02:50
  • See also this related [Q&A](http://stackoverflow.com/q/17872245/230513). – trashgod May 13 '15 at 17:27

0 Answers0