【问题标题】:NACHOS on eclipse exception in thread "main"NACHOS 在线程“main”中出现 Eclipse 异常
【发布时间】:2014-10-27 11:02:12
【问题描述】:

在 Eclipse 中运行 nachos 时出现以下错误:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 

    at nachos.machine.Lib.assertTrue(Lib.java:75)
    at nachos.machine.Machine.main(Machine.java:24)

以上两种方法如下:

nachos.machine.Lib.assertTrue:

public static void assertTrue(boolean expression) {
    if (!expression)
        throw new AssertionFailureError();
    }

nachos.machine.Machine.main:

 public static void main(final String[] args) {
    System.out.println("nachos 5.0j initializing...");
    Lib.assertTrue(Machine.args == null);//This is the call after which error is thrown
    Machine.args = args;

    processArgs();

    Config.load(configFileName);

    // get the current directory (.)
    baseDirectory = new File(new File("").getAbsolutePath());
    // get the nachos directory (./nachos)
    nachosDirectory = new File(baseDirectory, "nachos");

    String testDirectoryName =
        Config.getString("FileSystem.testDirectory");

    // get the test directory
    if (testDirectoryName != null) {
        testDirectory = new File(testDirectoryName);
    }
    else {
        // use ../test
        testDirectory = new File(baseDirectory.getParentFile(), "test");
    }

    securityManager = new NachosSecurityManager(testDirectory);
    privilege = securityManager.getPrivilege();

    privilege.machine = new MachinePrivilege();

    TCB.givePrivilege(privilege);
    privilege.stats = stats;

    securityManager.enable();
    createDevices();
    checkUserClasses();

    autoGrader = (AutoGrader) Lib.constructObject(autoGraderClassName);

    new TCB().start(new Runnable() {
        public void run() { autoGrader.start(privilege); }
    });
    }

【问题讨论】:

  • Unresolved compilation problem 表示源代码中存在编译错误。您需要显示编译错误消息。
  • 您的意思是AssertionFailureError 还是AssertionFailedError?如果是前者 - 它在哪里以及如何定义?
  • 是的,AssertionFailureError 定义如下: class AssertionFailureError extends Error { AssertionFailureError() { super(); } AssertionFailureError(String message) { super(message); } } /*在编译时出现以下错误:可序列化类 AssertionFailureError 没有声明 long 类型的静态最终 serialVersionUID 字段。*/

标签: java nachos


【解决方案1】:

当我尝试通过 Eclipse 运行玉米片时,我遇到了同样的错误。我所做的是查看 Lib.java 并向下滚动到带有 eclipse 错误的函数。对我来说是checkDerivation。参数 <?> 上应该有一个 eclipse 错误,如果你查看自动修复 eclipse 给你并选择项目范围的修复 nachos 应该在那之后运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-19
    • 2017-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-05
    相关资源
    最近更新 更多