为什么找不到主班? [英] Why it could not find the main class?

查看:148
本文介绍了为什么找不到主班?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的代码:

I have a very simple code:

package mygame;
public class RunGame {
    public static void main(String[] args) {
        System.out.println(args[0]);
    }
}

我可以编译该代码,但无法运行它.当我在命令行中键入"java RunGame"时,我得到:

I can compile that code but I cannot run it. When I type "java RunGame" in the command line I get:

线程主"中的异常 java.lang.NoClassDefFoundError: RunGame(名称错误:mygame/RunGame).
....
找不到主类: RunGame.程序将退出.

Exception in thread "main" java.lang.NoClassDefFoundError: RunGame (wrong name: mygame/RunGame).
....
Could not find the main class: RunGame. Program will exit.

推荐答案

java mygame.RunGame 

是Java可执行语法.即java classname.qualified.with.full.packaging

is the java executable syntax. i.e, java classname.qualified.with.full.packaging

您显示的输出中的RunColoredTrails类又是什么?

Also what is the RunColoredTrails class in the output you have shown?

这篇关于为什么找不到主班?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆