•
•
•
•
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
![]() |
•
•
Join Date: Oct 2006
Posts: 158
Reputation:
Rep Power: 3
Solved Threads: 0
Hi,
I have this Java code not running properly with showing the following error at command prompt on Linux os.
Can any one help please? Thanks.....
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);
}
}
}
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
http://java.sun.com/docs/books/tutor...let/index.html
•
•
Join Date: Oct 2006
Posts: 158
Reputation:
Rep Power: 3
Solved Threads: 0
•
•
•
•
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.
•
•
Join Date: Aug 2007
Posts: 74
Reputation:
Rep Power: 2
Solved Threads: 9
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
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- java.lang.NoSuchMethodError: main ?? (Java)
- java.lang.NoSuchMethodError: (Java)
- java.lang.NoSuchMethodError (Java)
- java.lang.NoClassDefFoundError: JBuilder (Java)
- Question about java.lang.SecurityException (Java)
- Following tutorials and getting java.lang.NoClassDefFoundError (Java)
Other Threads in the Java Forum
- Previous Thread: How to maintain Session
- Next Thread: translate c into java



Linear Mode