Question about main function / how do you do anything if it's static?

I am using the ACM libraries, but in order to export a jar I need to have the public static void main (string args[]) be my main entry function.

I have a "run()" function already defined which is what the ACM libraries use (of course I'm sure there is a main() somewhere since the ACM libraries are built upon real Java)

Here is a short snippet of run :

publicvoid run()

{

addMouseListeners();

lastStartI =newint[8];

lastEndI =newint[8];

// init IO console

// build the array of letters

buildList(letters);

// add in UI elements:

topOps =new GLabel("");

As you can see there are alot of calls to non-static functions.

How is it possible to have the entry point to a program be static? How do you ever call a non-static function? It doesn't make any sense.

I need to somehow use the main() function so I can export a jar

[1300 byte] By [SalikSyeda] at [2007-11-26 23:41:39]
# 1

> How is it possible to have the entry point to a program be static?

At the start of the program there are no objects. How do you expect the main method to be nonstatic when it doesn't have an object associated with it?

>How do you ever call a non-static function?

Create an object.

Message was edited by:

EvilBro

EvilBroa at 2007-7-11 15:09:27 > top of Java-index,Java Essentials,New To Java...