【问题标题】:no main methods, applets, or Midlets found in file jgrasp在文件 jgrasp 中找不到主要方法、小程序或 Midlet
【发布时间】:2016-08-07 17:34:51
【问题描述】:

在我的代码中,我在其中放置了一个 main 方法。该程序在 jgrasp 上编译,没有错误。但它一直给我一条消息:“在文件 jgrasp 中找不到主要方法、小程序或 Midlet”

  import java.io.*;
  public class XOREncyrption
  {//start of  class

  public static void Main(String [] args)
  {//start of main
  File f = new File("data.txt");
  File g = new File("key.txt");



  try
  {

     FileInputStream r = new FileInputStream(f);
     FileInputStream x = new FileInputStream(g);
     byte [] me = new byte [(int)f.length()];
     byte [] we =new byte [(int)g.length()];


   int why = r.read(me);
   int where =x.read(we);

      //input.close();

  }
   catch(FileNotFoundException e)
  {
     System.out.print("No file");
  }
  catch(IOException e)
  {
     System.out.println("error");
  }


  }//end of main
  }//end of class

如果有人能弄清楚为什么代码告诉我有一个 main 方法时没有 main 方法,我将不胜感激。

【问题讨论】:

    标签: java file exception main


    【解决方案1】:

    入口方法必须命名为“main”(小写“m”)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-23
      • 2012-01-03
      • 1970-01-01
      相关资源
      最近更新 更多