简体   繁体   English

没有发现Class Def错误

[英]No Class Def Found error

I wrote the following class in NetBeans and ran it successfully. 我在NetBeans中编写了以下类并成功运行它。 But when I uploaded it to the IEEE moshack server where I participated for the IEEE Extreme competition. 但是当我将它上传到我参加IEEE Extreme竞赛的IEEE moshack服务器时。

It says that my program gives a run-time error. 它说我的程序给出了运行时错误。 Can you please tell me why? 你能告诉我为什么吗?

import java.util.Scanner;


public class BloomFilter {

    public static void main(String[] args) {


        Scanner sc = new Scanner(System.in);

        int[] a = new int[26];
        for (int b : a) {
            b = 0;
        }


        String s = sc.nextLine();
       String s1 = sc.nextLine();


        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) >= 65 && s.charAt(i) <= 90) {

                int p = s.charAt(i) - 65;

                a[p] = 1;

            }

            if ((s.charAt(i) >= 97 && s.charAt(i) <= 122)) {

                int p = s.charAt(i) - 97;

                a[p] = 1;
            }
        }

        String[] tokens = s1.split("[^a-zA-Z]");
        int totWords = 0;

        for (String s2 : tokens) {
            s2.toLowerCase();
            totWords++;
            for (int j = 0; j < s2.length(); j++) {
                if (a[s2.charAt(j) - 97] == 0) {
                    totWords--;
                    break;
                }
            }

        }

        System.out.print(totWords);


    }
}

Older versions of DomJudge for example required that Java classes are named Main ; 例如,旧版本的DomJudge要求Java类名为Main ; more recent versions are better in that regard, but maybe a similar restriction is in place where you uploaded it. 在这方面,更新的版本更好,但也许你上传它的类似限制。

Check the error message for the class name Java expected and try renaming your class (and the file, of course). 检查Java期望的类名称的错误消息,并尝试重命名您的类(当然还有文件)。

EDIT: Apparently you tried running it with java BloomFilter.class instead of java BloomFilter . 编辑:显然你尝试用java BloomFilter.class而不是java BloomFilter运行它。 I doubt this is a problem with the submission system, though (such things are spotted earlier, generally), so maybe there is a place somewhere where you give the command to run. 我怀疑这是提交系统的一个问题,但是(通常会在早期发现这些事情),所以也许有一个地方可以让命令运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM