User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 426,463 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,237 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 910 | Replies: 4
Reply
Join Date: Oct 2006
Posts: 158
Reputation: tech291083 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
tech291083 tech291083 is offline Offline
Junior Poster

java.lang.NoSuchMethodError

  #1  
Aug 29th, 2007
Hi,

I have this Java code not running properly with showing the following error at command prompt on Linux os.

 
[root@localhost PracJava]# javac clicker.java
[root@localhost PracJava]# java clicker
Exception in thread "main" java.lang.NoSuchMethodError: main

Can any one help please? Thanks.....


 
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
 
public class clicker extends Applet implements ActionListener
{
TextField text1;
Button button1;
 
public void init()
{
text1 = new TextField(20);
add(text1);
button1 = new Button("Click here!");
add(button1);
button1.addActionListener(this);
}
 
public void actionPerformed(ActionEvent event)
{
String msg=new String ("Welcome to Java");
if(event.getSource()==button1)
{
text1.setText(msg);
}
}
}
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,843
Reputation: Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all Ezzaral is a name known to all 
Rep Power: 12
Solved Threads: 283
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is online now Online
Posting Maven

Re: java.lang.NoSuchMethodError

  #2  
Aug 29th, 2007
Applets are not started from the command line like a regular java program. You need to use the Java Applet Viewer or embed them in a small test web page. If you typed this program from a book then there are probably instructions there on how to run the applet. If not, read the following tutorial on getting started with applets:
http://java.sun.com/docs/books/tutor...let/index.html
Reply With Quote  
Join Date: Aug 2007
Posts: 8
Reputation: vivek_green is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vivek_green vivek_green is offline Offline
Newbie Poster

Re: java.lang.NoSuchMethodError

  #3  
Aug 29th, 2007
Applet requires appletviewer to execute its code.
Pls find the utility by name appletviewer in the java installed utility directory u wil find the exe for running the applet.
Reply With Quote  
Join Date: Oct 2006
Posts: 158
Reputation: tech291083 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
tech291083 tech291083 is offline Offline
Junior Poster

Re: java.lang.NoSuchMethodError

  #4  
Aug 30th, 2007
Originally Posted by vivek_green View Post
Applet requires appletviewer to execute its code.
Pls find the utility by name appletviewer in the java installed utility directory u wil find the exe for running the applet.


Hi,

Thanks.

Can you please tell me as how I can find the instructions in the installed directory on Linux. I am on Fedora core 5 32+ bit as my OS. I am new to Java and need some help. I have also tried to run a few basic applets in Firefox but it only shows a grey box and says download the required plug in etc. I am getting a bit confused here please help me out with this. Thanks for your time and patience. Cheers.
Reply With Quote  
Join Date: Aug 2007
Posts: 74
Reputation: lookof2day is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 9
lookof2day lookof2day is offline Offline
Junior Poster in Training

Re: java.lang.NoSuchMethodError

  #5  
Aug 31st, 2007
You need to install Java plugin for Firefox. Here's what you are required to do:

sudo ln -s /usr/lib/jvm/jre1.6.0_01/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/libjavaplugin_oji.so

i.e., you are creating a symbolic linc (short cut in Windows) to the libjavaplugin_oji.so file which firefox can use.

If in fedora, you do not have "sudo", then use "su" instead. Also, find the path where jre is installed on your system.

On my system it is installed in /usr/lib/jvm/jre1.6.0_01/ directory
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 3:43 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC