![]() |
| ||
| Urgent!! help needed please please! 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 |
| ||
| Re: Urgent!! help needed please please! [edit] Nonsense... |
| ||
| Re: Urgent!! help needed please please! 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 |
| ||
| Re: Urgent!! help needed please please! 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? |
| ||
| Re: Urgent!! help needed please please! Quote:
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? |
| ||
| Re: Urgent!! help needed please please! 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 |
| ||
| Re: Urgent!! help needed please please! For starters, this is not a valid method body public void init()This is public void init() { |
| ||
| Re: Urgent!! help needed please please! I don't see the urgency here. Haven't felt the need to use an applet for a decade. |
| ||
| Re: Urgent!! help needed please please! 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. . |
| ||
| Re: Urgent!! help needed please please! 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... |
| All times are GMT -4. The time now is 5:13 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC