java.lang.NoClassDefFoundError: javax/media/opengl/GLException at processing.opengl.PGraphicsOpenGL

萝らか妹 提交于 2020-01-06 19:25:40

问题


I am writing a program in Processing on Raspberrypi(Raspbian), to import a 3D STL image file. It is working perfectly on Microsoft (windows7) & Linux(Ubuntu) platform but I am struggling to run same program on Raspberrypi (Raspbian) platform.

I am getting below Error at size(600,600,P3D) when I run this program on Raspberrypi...

Coding

import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.processing.*;
TriangleMesh mesh;
ToxiclibsSupport gfx;
void setup() {
  size(600,600,P3D);
  mesh=(TriangleMesh)new STLReader().loadBinary(sketchPath("check.stl"),STLReader.TRIANGLEMESH);
  gfx=new ToxiclibsSupport(this);
}

void draw() {
  background(51);
  lights();
  translate(width/2,height/2,0);
  rotateX(mouseY*0.01);
  rotateY(mouseX*0.01);
  gfx.origin(new Vec3D(),200);
  noStroke();
  gfx.mesh(mesh,false,10);
}

Error

java.lang.NoClassDefFoundError: javax/media/opengl/GLException
    at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744)
    at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:518)
    at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:37)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at processing.core.PApplet.makeGraphics(PApplet.java:1919)
    at processing.core.PApplet.size(PApplet.java:1771)
    at processing.core.PApplet.size(PApplet.java:1742)
    at project5.setup(project5.java:27)
    at processing.core.PApplet.handleDraw(PApplet.java:2361)
    at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
    at processing.core.PApplet.run(PApplet.java:2256)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 15 more

回答1:


The issue with Processing is that currently there is no 3D implementation because Raspberry PI needs an OPENGL_ES renderer. Currently you can only render in 2D (e.g. size(200,200,JAVA2D);).

There is actually an OPENGL_ES renderer in Processing but it's for the Android mode and it has dependencies on the android SDK. As far as I know, there isn't any Processing OPENGL_ES renderer you can use on Raspberry PI at the moment(if someone knows of one, please let me know). In theory how ever, it should be possible to strip out the android dependencies from the Android PGraphics class, but feels like a risky move (especially if you have a tight deadline).To get started you may want to look EGL in java running on Rasperry Pi.

I would recommend using OpenFrameworks instead in this case, if displaying an STL file is all you need. I've modified an existing STL addon for OpenFramworks and tested it: the performance is great on the Raspberry PI. Although it's c++, the project is inspired by Processing and a lot of the functions will sound very familiar.

Once you setup OpenFramworks you can download ofxSTLModel and compile the example(I've updated it to run on Raspberry PI). Press any key to toggle wireframe view.

Update Now there is an experimental Raspian image including Processing 3 with 3D support. Check out this thread



来源:https://stackoverflow.com/questions/29376404/java-lang-noclassdeffounderror-javax-media-opengl-glexception-at-processing-ope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!