本文介绍了使用 java.lang.NoSuchFieldError 创建 UnfoldingMap 实例:质量错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用 UnfoldingMap (v0.9.6) 创建 PApplet(处理).不幸的是,我在这一行收到 java.lang.NoSuchFieldError: quality 错误:map = new UnfoldingMap(this, p1).如果有可能是什么原因?
import de.fhpotsdam.unfolding.UnfoldingMap;进口 de.fhpotsdam.unfolding.providers.AbstractMapProvider;导入 de.fhpotsdam.unfolding.providers.Google;导入 de.fhpotsdam.unfolding.utils.MapUtils;导入处理.core.PApplet;公共类 MyPApplet2 扩展了 PApplet{展开地图地图;公共静态无效主(字符串 [] args){PApplet.main(new String[] {MyPApplet2.class.getName() });}公共无效设置(){尺寸(400、400、P2D);}公共无效设置(){AbstractMapProvider p1 = new Google.GoogleTerrainProvider();map = new UnfoldingMap(this, p1);MapUtils.createDefaultEventDispatcher(this, map);}公共无效画(){地图绘制();}}
我收到以下错误:
线程Thread-3"中的异常 java.lang.RuntimeException: java.lang.NoSuchFieldError: quality在 processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:443)在 java.lang.Thread.run(未知来源)引起:java.lang.NoSuchFieldError:质量在 de.fhpotsdam.unfolding.mapdisplay.OpenGLMapDisplay.(来源不明)在 de.fhpotsdam.unfolding.mapdisplay.MapDisplayFactory.getMapDisplay(来源不明)在 de.fhpotsdam.unfolding.UnfoldingMap.(来源不明)在 de.fhpotsdam.unfolding.UnfoldingMap.(来源不明)在 module3.MyPApplet2.setup(MyPApplet2.java:23)在 processing.core.PApplet.handleDraw(PApplet.java:2374)在 processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:731)在 jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)在 jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)在 jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)在 jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)在 jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)在 com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)在 com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)在 com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)在 com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)在 java.util.TimerThread.mainLoop(来源不明)在 java.util.TimerThread.run(未知来源)
解决方案
抛出此错误是因为我们更改了特定类的定义,并且没有重新编译那些引用该类的类.
>
/*** 使用给定的 ID 创建一个新的完整画布地图.** @参数p* 主小程序.* @param id* 此地图的 ID.*/public UnfoldingMap(PApplet p, String id) {this(p, id, 0, 0, p.width, p.height, true, false, null, null);}
尝试使用这样的东西:
AbstractMapProvider p1 = new Google.GoogleTerrainProvider();设置();map = new UnfoldingMap(this, 50, 50, 500, 350, p1);
I try to create PApplet (Processing) with UnfoldingMap (v0.9.6). Unfortunatelly I get java.lang.NoSuchFieldError: quality error at this line: map = new UnfoldingMap(this, p1). What may be the reason if it?
import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.providers.AbstractMapProvider;
import de.fhpotsdam.unfolding.providers.Google;
import de.fhpotsdam.unfolding.utils.MapUtils;
import processing.core.PApplet;
public class MyPApplet2 extends PApplet{
UnfoldingMap map;
public static void main(String[] args) {
PApplet.main(new String[] {MyPApplet2.class.getName() });
}
public void settings() {
size(400, 400, P2D);
}
public void setup() {
AbstractMapProvider p1 = new Google.GoogleTerrainProvider();
map = new UnfoldingMap(this, p1);
MapUtils.createDefaultEventDispatcher(this, map);
}
public void draw() {
map.draw();
}
}
I receive the following error:
Exception in thread "Thread-3" java.lang.RuntimeException: java.lang.NoSuchFieldError: quality
at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:443)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchFieldError: quality
at de.fhpotsdam.unfolding.mapdisplay.OpenGLMapDisplay.<init>(Unknown Source)
at de.fhpotsdam.unfolding.mapdisplay.MapDisplayFactory.getMapDisplay(Unknown Source)
at de.fhpotsdam.unfolding.UnfoldingMap.<init>(Unknown Source)
at de.fhpotsdam.unfolding.UnfoldingMap.<init>(Unknown Source)
at module3.MyPApplet2.setup(MyPApplet2.java:23)
at processing.core.PApplet.handleDraw(PApplet.java:2374)
at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:731)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
解决方案
This error is thrown because we changed the definition of a specific class and we didn’t re-compile those classes that have a reference to that class.
/**
* Creates a new full canvas map with the given ID.
*
* @param p
* The main applet.
* @param id
* The ID of this map.
*/
public UnfoldingMap(PApplet p, String id) {
this(p, id, 0, 0, p.width, p.height, true, false, null, null);
}
Try to use something like this:
AbstractMapProvider p1 = new Google.GoogleTerrainProvider();
settings();
map = new UnfoldingMap(this, 50, 50, 500, 350, p1);
这篇关于使用 java.lang.NoSuchFieldError 创建 UnfoldingMap 实例:质量错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!