Trying to compile program using Swing.

I am trying to compile a SWING program (i.e. JFrame, JButton etc). Program does not have main method.

Obviously when I compile, I get

Exception in thread "main" java.lang.NoSuchMethodError: main.

Isnt it allowable to have a Swing pgm without a main method ?

Am I missing something obvious? Do I need to move a Swing jar file somewhere? Using J2SDK1.4.0 on WindowsME. Java is installed OK, because I can compile and execute other basic programs..

[477 byte] By [JohnnieHoosiera] at [2007-9-27 9:15:37]
# 1

No, all Java programs, just like C/C++ require a main() method entry point.

Typically, in a Swing program, all you need to this is this (at the very minimum)

public static void main(String[] args) {

JFrame myAppFrame = new JFrame();

myAppFrame.show();

}

Usually you don't create a generic JFrame but instead extend your own class from a JFrame and put all of the initialization (JMenuBars, JPanels, windowlisteners, etc) in its constructor.

darinda at 2007-7-8 21:55:57 > top of Java-index,Developer Tools,Java Compiler...