•
•
•
•
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,200 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,212 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: 624 | Replies: 14
•
•
Join Date: May 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- FRONTECH tv tuner card - stuck lost - urgent help needed (PCI and Add-In Cards)
- Urgent help is needed SQL datatypes (Database Design)
- Urgent help needed regarding executing Scripts in AJAX response (JavaScript / DHTML / AJAX)
- URGENT HELP NEEDED - critically important...!!! (Windows NT / 2000 / XP / 2003)
- extreme urgent help needed (Geeks' Lounge)
- Urgent help needed (Database Design)
- Urgent help needed.!!.Please (C)
- URGENT Help Needed With TicTacToe Application Source Code!!! (Java)
Other Threads in the Java Forum
- Previous Thread: Read in from a text file randomly
- Next Thread: Help! JApplet -> JFrames



Threaded Mode