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 374,148 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 3,474 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: 514 | 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,556
Reputation: niek_e is a jewel in the rough niek_e is a jewel in the rough niek_e is a jewel in the rough niek_e is a jewel in the rough 
Rep Power: 8
Solved Threads: 157
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.
"= != =="

PM's asking for help will be ignored..
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 1,907
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 9
Solved Threads: 216
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Posting Virtuoso

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: 1,907
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 9
Solved Threads: 216
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Posting Virtuoso

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,494
Reputation: Ezzaral is just really nice Ezzaral is just really nice Ezzaral is just really nice Ezzaral is just really nice 
Rep Power: 9
Solved Threads: 251
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Nearly a 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,588
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: 187
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.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 670
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: 42
jephthah's Avatar
jephthah jephthah is offline Offline
Practically a 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.
I drink your milkshake.
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,588
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: 187
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...
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Reply

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

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

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

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