简体   繁体   English

如何解决线程“ main”中的异常java.lang.NoClassDefFoundError

[英]How to solve Exception in thread “main” java.lang.NoClassDefFoundError

I am installing eclipse in my mac and just try to test this code but show the error "Exception in thread "main" java.lang.NoClassDefFoundError" How i can solv or fixed it? 我正在Mac中安装eclipse,只是尝试测试此代码,但显示错误“线程“主”中的异常” java.lang.NoClassDefFoundError”我如何解决或修复它?

import java.util.*;
import java.io.*;

public class MyMain
{
    public static void main(String[] args)
    {
        //System.out.println("Hello world");
    }
}

In eclipse select this menu: Run > Run Configurations... 在Eclipse中,选择以下菜单: 运行 > 运行配置...。

在此处输入图片说明

Then select the Run configuration of your test code. 然后选择测试代码的“运行”配置。

在此处输入图片说明

In the Main class field check what's written there... If the class MyMain has no package, Main class field should contain "MyMain". 在“ 主类”字段中检查其中写的内容...如果类MyMain没有包,则“ 主类”字段应包含“ MyMain”。

This class should compile and work if the file is called MyMain.java. 如果该文件名为MyMain.java,则该类应编译并运行。 to compile it just run javac MyMain from the same directory the file is located. 要编译它,只需从文件所在的目录运行javac MyMain Then run java MyMain and you are good. 然后运行java MyMain ,您就很好了。

暂无
暂无

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

相关问题 如何解决错误消息线程“ main”中的异常java.lang.NoClassDefFoundError:org / usb4java / Loader - How to solve error message Exception in thread “main” java.lang.NoClassDefFoundError: org/usb4java/Loader 线程“main”java.lang.NoClassDefFoundError中的异常 - Exception in thread “main” java.lang.NoClassDefFoundError 线程“ main” java.lang.NoClassDefFoundError中的异常: - exception in thread“main”java.lang.NoClassDefFoundError: 线程“ main”中的异常java.lang.NoClassDefFoundError - Exception in thread “main” java.lang.NoClassDefFoundError 主线程java.lang.NoClassDefFoundError中的异常 - Exception in main thread java.lang.NoClassDefFoundError 线程“ main”中的异常java.lang.NoClassDefFoundError - exception in thread 'main' java.lang.NoClassDefFoundError 线程“main”java.lang.NoClassDefFoundError中的异常: - Exception in thread “main” java.lang.NoClassDefFoundError: 线程“主”java.lang.NoClassDefFoundError 中的异常: - exception in thread 'main' java.lang.NoClassDefFoundError: 我如何解决此错误线程“ main”中的异常java.lang.NoClassDefFoundError:javax / crypto / SecretKey - how do I solve this error Exception in thread “main” java.lang.NoClassDefFoundError: javax/crypto/SecretKey 如何解决“主线程” java.lang.NoClassDefFoundError中的异常:org / apache / poi / ss / usermodel / Row' - How to solve 'Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Row'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM