String s;
InputStreamReader ir = new InputStreamReader(System.in);
    BufferedReader in = new BufferedReader(ir);    try{
while ((s = in.readLine()) != null) {
             System.out.println("Read: " + s);
         }
in.close();
    }catch (IOException e){ // Catch any IO exceptions.
         e.printStackTrace();
    }
在win2000+jdk1.5+eclipse3.1.1下
系统提示:
java.lang.NoSuchMethodError: main

解决方案 »

  1.   

    http://delia.org.ru/ArticleView/2005-9-4/Article_View_22643.Htm
      

  2.   

    这是完整的程序吗?怎么类也没有,编译能通过吗?从提示看,好象是没有main方法
      

  3.   

    你没有main主函数,她找不到MAIN的入口,当然报错
      

  4.   

    我在我的机子上运行了。没有错误。XP(sp1)+jdk1.4+eclipse3.0.1.
      

  5.   

    问题应该不是处在你给出的地方java.lang.NoSuchMethodError: main
    Exception in thread "main" 
    是主类中没有main方法造成的
      

  6.   

    import java.io.*;
    public class  A
    {
    public static void main(String[] args) 
    {
    String s;
    InputStreamReader ir = new InputStreamReader(System.in);
    BufferedReader in = new BufferedReader(ir); try{
    while ((s = in.readLine()) != null) {
                 System.out.println("Read: " + s);
             }
    in.close();
        }catch (IOException e){ // Catch any IO exceptions.
             e.printStackTrace();
        }
    System.out.println("Hello World!");
    }
    }没有问题!!!!用editplus,jdk1.4