JOGL图表编译错误

发布于 2024-11-26 20:50:39 字数 3702 浏览 0 评论 0原文

我正在尝试使用 Jzy3D 库并在 openGl 下绘制一些图表。 但是,当我尝试编译代码时,出现以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLCanvas
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.jzy3d.chart.Chart.initializeCanvas(Chart.java:65)
    at org.jzy3d.chart.Chart.<init>(Chart.java:56)
    at org.jzy3d.chart.Chart.<init>(Chart.java:39)
    at mychart.MyChart.<init>(MyChart.java:44)
    at mychart.MyChart.main(MyChart.java:58)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLCanvas
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 17 more

我还添加了我编写的代码,以防出现问题:

package mychart;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Frame;

import org.jzy3d.chart.Chart;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import org.jzy3d.colors.colormaps.ColorMapRainbow;
import org.jzy3d.maths.Range;
import org.jzy3d.plot3d.builder.Builder;
import org.jzy3d.plot3d.builder.Mapper;
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
import org.jzy3d.plot3d.primitives.Shape;
import org.jzy3d.plot3d.rendering.legends.colorbars.ColorbarLegend;

public class MyChart {

    protected Chart chart;

    public MyChart(){

        Mapper mapper = new Mapper(){

            @Override
            public double f(double x, double y) {
                // TODO Auto-generated method stub
                return 20*x*(1-Math.sin(y));
            }
        };

        Range range = new Range(-100, 100);
        int steps = 30;

        final Shape surface = (Shape) Builder.buildOrthonormal
                (new OrthonormalGrid(range, steps, range, steps), mapper);
        surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), 
                surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
        surface.setFaceDisplayed(true);
        surface.setWireframeDisplayed(true);
        surface.setWireframeColor(Color.BLACK);

        chart = new Chart();
        chart.getScene().getGraph().add(surface);

        ColorbarLegend cl = new ColorbarLegend(surface, chart.getView().getAxe().getLayout());
        cl.setMinimumSize(new Dimension(100, 300));

        surface.setLegend(cl);  
    }

    public Chart getChart(){
        return chart;
    }

    public static void main(String[] args){
        MyChart myChart = new MyChart();

        Frame frame = new Frame();
        frame.setSize(1000, 600);
        frame.add((Component)myChart.getChart().getCanvas());
        frame.setVisible(true);
    }
}

我正在使用 Eclipse Indigo IDE、Jogl 2.0 库(当我将它们导入 Eclipse 时,我填写了本机库路径),Jzy3D 0.8.4 版本。我正在 Windows 7 Ultimate 下工作。

I´m trying to work with Jzy3D library and paint some charts under openGl.
But when I try to compile the code I obtain following error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLCanvas
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.jzy3d.chart.Chart.initializeCanvas(Chart.java:65)
    at org.jzy3d.chart.Chart.<init>(Chart.java:56)
    at org.jzy3d.chart.Chart.<init>(Chart.java:39)
    at mychart.MyChart.<init>(MyChart.java:44)
    at mychart.MyChart.main(MyChart.java:58)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLCanvas
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 17 more

I also add the code that I wrote, in case there was some problem:

package mychart;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Frame;

import org.jzy3d.chart.Chart;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import org.jzy3d.colors.colormaps.ColorMapRainbow;
import org.jzy3d.maths.Range;
import org.jzy3d.plot3d.builder.Builder;
import org.jzy3d.plot3d.builder.Mapper;
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
import org.jzy3d.plot3d.primitives.Shape;
import org.jzy3d.plot3d.rendering.legends.colorbars.ColorbarLegend;

public class MyChart {

    protected Chart chart;

    public MyChart(){

        Mapper mapper = new Mapper(){

            @Override
            public double f(double x, double y) {
                // TODO Auto-generated method stub
                return 20*x*(1-Math.sin(y));
            }
        };

        Range range = new Range(-100, 100);
        int steps = 30;

        final Shape surface = (Shape) Builder.buildOrthonormal
                (new OrthonormalGrid(range, steps, range, steps), mapper);
        surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), 
                surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
        surface.setFaceDisplayed(true);
        surface.setWireframeDisplayed(true);
        surface.setWireframeColor(Color.BLACK);

        chart = new Chart();
        chart.getScene().getGraph().add(surface);

        ColorbarLegend cl = new ColorbarLegend(surface, chart.getView().getAxe().getLayout());
        cl.setMinimumSize(new Dimension(100, 300));

        surface.setLegend(cl);  
    }

    public Chart getChart(){
        return chart;
    }

    public static void main(String[] args){
        MyChart myChart = new MyChart();

        Frame frame = new Frame();
        frame.setSize(1000, 600);
        frame.add((Component)myChart.getChart().getCanvas());
        frame.setVisible(true);
    }
}

I´m using Eclipse Indigo IDE, Jogl 2.0 libraries (when I imported them into Eclipse I filled the Native Library Path), Jzy3D 0.8.4 version. I´m working under Windows 7 Ultimate.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沙沙粒小 2024-12-03 20:50:39

Jzy3D 可能需要 JOGL 1.x

Jzy3D probably requires JOGL 1.x

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文