JApplet NoClassDefFoundError [英] JApplet NoClassDefFoundError

查看:26
本文介绍了JApplet NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Eclipse 上编写一个 Japplet,时不时地,它停止在 html 页面上工作.

I'm writing an Japplet on Eclipse, and from a moment to another, it stopped to work on the html page.

以下是错误:

  Exception in thread "thread applet-main.MapGenerator.class-1" java.lang.NoClassDefFoundError: com/google/gson/Gson
at main.Floor.parse(Floor.java:39)
at main.MapGenerator.loadParameters(MapGenerator.java:64)
at main.MapGenerator.start(MapGenerator.java:28)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1698)
at java.lang.Thread.run(Thread.java:662)

  Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:252)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:250)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:180)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:161)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 5 more

这里也是服务器请求:

  "GET /static/java/MapGenerator.jar HTTP/1.1" 200 68177
  "GET /static/java/com/google/gson/Gson.class HTTP/1.1" 404 1697

重点是它试图找到服务器内部的Gson库而不是它的包......我不知道如何解决问题.

The point is that it tries to find the Gson library inside the server instead of its package... I don't know how to solve the problem.

如果你需要什么,尽管问.

If you need something, ask freely.

编辑

我已经在我的 eclipse 项目中导入了 Gson 的库.其实我不知道为什么小程序试图从服务器加载它......在 Eclipse 上它运行没有任何问题.

I have imported the Gson's library inside my project in eclipse. Actually I don't know why the applet tries to load it from the server... On Eclipse it runs withouth any problem.

编辑

我已经物理复制了 eclipse 项目中的库...它仍然试图从服务器获取它们...我不知道还能做什么...

I have copied physically the libraries inside the eclipse project... and it still try to get them from the server... I don't know what else do...

推荐答案

第一件事你没有添加 gson 库在您的类路径中,然后您的请求 (GET/static/java/com/google/gson/Gson.class HTTP/1.1) 是错误的.

1st thing you did not add gson library in your classpath and second your request(GET /static/java/com/google/gson/Gson.class HTTP/1.1) is wrong.

如果你在 /static/java 下有 gson jar,比如 MapGenerator.jar,你可以像对 MapGenerator.jar 一样请求 gson jar.但是你不能请求从那个 jar 中获取类.

If you have gson jar under /static/java like MapGenerator.jar, you could make request for gson jar same as you did for MapGenerator.jar. But you can not make request to get class from that jar.

这篇关于JApplet NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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