This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem in executing swing application

 
Ranch Hand
Posts: 55
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends, i'm facing a strange problem while ruuning a swing applet program. my program is compiling alright, but wenevr i mtrying to run it from command prompt, it's showing the following exception::

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

even in netbeans ide it's showing the same thing?
where m i going wrong??
 
Marshal
Posts: 69864
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a main method in the class you are invoking from the command line. It must have a certain heading format.
 
Campbell Ritchie
Marshal
Posts: 69864
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your spelling is all over the place. If you spell your Java™ code as you spell your postings, you might have introduced an error into your code which can cause such an Exception.
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you're trying to run the compiled applet code using a command line command:

> java applet

( > is the command line prompt, not something you'd type )

where "applet.class" is the name of your compiled applet.java source file.

Applets are viewed/run from within an HTML file. There are several places on the internet that give you advice on how to construct an HTML file to run an Applet from the command line or use command line Applet viewers. Since I don't know your particular environment setup, I won't recommend a particular one of those.

Netbeans should have the ability to run your source code as an Applet. If you right click on the source file, do you get a context menu with "Run as . . ." or "Run as Applet" as a selection? If so, pursue that to use Netbeans' internal Applet viewer.

Come back if you need more help.
 
Rituparna Duttagupta
Ranch Hand
Posts: 55
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks foryour information, but no, i don't make spelling alteration while coding.
and i've checked everything, even after including the main method the applet is not showing.
actually, the last 3 years i was into jsp, servlet,session, stateful and entity beans.
i think i am terribly faulting somewhere, since i was detached from swing/applet forlong period of time.
:-)
 
Campbell Ritchie
Marshal
Posts: 69864
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are going to have to post the class you are trying to run, please.
 
Campbell Ritchie
Marshal
Posts: 69864
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and sorry, I missed the bit about applets. You usually open applets from an html file, which you open with a browser, as Greg Brannon has already told you.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic