首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用jGrasp的库?

如何使用jGrasp的库?
EN

Stack Overflow用户
提问于 2018-02-09 03:19:58
回答 1查看 589关注 0票数 0

我有一个文件夹,里面装满了我选课的课程。随着jGrasp的全新安装,过去运行良好的旧项目现在充满了“找不到符号”的错误。

我仍然拥有这些库,但我不知道如何导入它们。按照我们的类的设置方式,库中的任何内容都不需要import语句。

代码语言:javascript
复制
/* Turtle Drawing Program Lab 6, Part B */
/* Started by Celine Latulipe , modified by Bruce Long*/

public class Lab6PartB {
  public static void main(String [] args) 
  {
    /* Create the world */
    World w = new World();

    /* Create the turtle, call him Tom */
    Turtle tom = new Turtle(w);

    /* test the getDistance2() method */
    int dist = tom.getDistance2();
    System.out.println("This should print out the value 400. Value is: " + dist);

    tom.moveTo(500, 400);
    dist = tom.getDistance2();
    System.out.println("This should print out the value 640. Value is: " + dist);

    // TODO: Add a third test case that you make up

  }
}

错误:

代码语言:javascript
复制
 ----jGRASP exec: java Lab6PartB
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: ModelDisplay
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: ModelDisplay
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more

 ----jGRASP wedge2: exit code for process is 1.
 ----jGRASP: operation complete.
EN

回答 1

Stack Overflow用户

发布于 2018-02-09 22:05:31

您可以在操作系统级别或使用jGRASP中的“设置”>“路径/类路径”>“工作区”将包含类文件的目录添加到类路径中。

此外,您还可以将所有类文件/目录复制到包含新项目类的文件夹中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48693216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档