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 428,065 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,482 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: 623 | Replies: 14
Reply
Join Date: May 2008
Posts: 3
Reputation: mattcrow is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mattcrow mattcrow is offline Offline
Newbie Poster

Urgent!! help needed please please!

  #1  
May 15th, 2008
Hi everyone

I need to hand in this assignment today
Im trying to read from a file and read it onto the screen, my code keeps showing up an error saying 'java.lang.NoSuchMethodError: Main'

Here is my code:

import java.io.*;
import java.awt.*;
import java.applet.*;

public class Empty_3 extends Applet {

TextArea ta = new TextArea();

public void init()
public static void main(String args[])
{
setLayout(new BorderLayout());
add(ta, BorderLayout.CENTER);
try {
InputStream in =
getClass().getResourceAsStream("test1.txt");
InputStreamReader isr =
new InputStreamReader(in);
BufferedReader br =
new BufferedReader(isr);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
String line;
while ((line = br.readLine()) != null) {
pw.println(line);
}
ta.setText(sw.toString());
} catch (IOException io) {
ta.setText("Ooops");
}
}
}



Can anyone help me please?

Thankyou

Matt
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,780
Reputation: niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all 
Rep Power: 11
Solved Threads: 185
niek_e's Avatar
niek_e niek_e is offline Offline
Posting Virtuoso

Re: Urgent!! help needed please please!

  #2  
May 15th, 2008
[edit] Nonsense...
Last edited by niek_e : May 15th, 2008 at 7:41 am.
Want better/more replies to your questions? Wrap your code in [code] [/code] tags!
do NOT pm me for help, in the best case, you'll get ignored
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,467
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 11
Solved Threads: 296
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Urgent!! help needed please please!

  #3  
May 15th, 2008
If you paid more attention in your classes you would know that Applet DO NOT USE "main" class call. For more info follow Sun Applet tutorials here
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: May 2008
Posts: 3
Reputation: mattcrow is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mattcrow mattcrow is offline Offline
Newbie Poster

Re: Urgent!! help needed please please!

  #4  
May 15th, 2008
well thats what i did at first but it came up with this error?

'missing method body, or declare abstract'
under the public void init()

so do you know where to go from there?
Reply With Quote  
Join Date: May 2008
Posts: 3
Reputation: mattcrow is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mattcrow mattcrow is offline Offline
Newbie Poster

Re: Urgent!! help needed please please!

  #5  
May 15th, 2008
Originally Posted by peter_budo View Post
If you paid more attention in your classes you would know that Applet DO NOT USE "main" class call. For more info follow Sun Applet tutorials here



well thats what i did at first but it came up with this error?

'missing method body, or declare abstract'
under the public void init()

so do you know where to go from there?
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,467
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 11
Solved Threads: 296
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Urgent!! help needed please please!

  #6  
May 15th, 2008
Well drop the code as you had before or how it should be based on the assistance of the link (please do not forget to use code tags, just simply click on the hash sign "#" in advanced editing options, "Go Advanced" will get you there) and some short explanation of you trying to do would be nice
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,857
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 offline Offline
Posting Maven

Re: Urgent!! help needed please please!

  #7  
May 15th, 2008
For starters, this is not a valid method body
public void init() 
This is
public void init() {
    // stuff
}
Last edited by Ezzaral : May 15th, 2008 at 9:32 am.
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 199
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Urgent!! help needed please please!

  #8  
May 15th, 2008
I don't see the urgency here. Haven't felt the need to use an applet for a decade.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 713
Reputation: jephthah is a jewel in the rough jephthah is a jewel in the rough jephthah is a jewel in the rough 
Rep Power: 4
Solved Threads: 46
jephthah's Avatar
jephthah jephthah is offline Offline
Master Poster

Re: Urgent!! help needed please please!

  #9  
May 16th, 2008
everything is urgent, it seems. people need to start posting their questions with subject headings like:

"Help Help!! Life or Death Problem Here!!!"

or maybe

"OMG MY ASS IS ON FIRE AND MY HEAD IS A-CATCHIN', SUMBODY PLS ANSWER MY Q!!!"

otherwise, im gonna get bogged down trying to answer all these merely "urgent" questions.



.
Last edited by jephthah : May 16th, 2008 at 4:42 pm.
Why so serious?
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 199
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Urgent!! help needed please please!

  #10  
May 17th, 2008
yah. It's no different in customer support. Customers flag every single issue as critical, with the inevitable result that we stop looking at that flag and determine ourselves what's important...
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
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 12:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC