java3D lib配置问题 [英] problems with java3D lib configuration

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

问题描述



我已经下载了j3d-1_5_2-linux-i586.zip,并解压缩了j3dcore .jar,j3dutils.jar,vecmath.jar,libj3dcore-ogl.so,libj3dcore-ogl-cg.so,并将它们全部添加到我的项目文件夹中的引用的库中。这会摆脱我正在获得的任何编译警告,但是当我编译并运行应用程序时,我得到以下异常!线程main中的异常java.lang.UnsatisfiedLinkError:java.library.path中的j3dcore-ogl
在java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
在java.lang.Runtime.loadLibrary0(Runtime.java:840)
在java.lang.System.loadLibrary(System.java :1047)
在javax.media.j3d.NativePipeline $ 1.run(NativePipeline.java:231)
在java.security.AccessController.doPrivileged(本机方法)
在javax.media。 j3d.NativePipeline.loadLibrary(NativePipeline.java:200)
在javax.media.j3d.NativePipeline.loadLibraries(NativePipeline.java:157)
在javax.media.j3d.MasterControl.loadLibraries(MasterControl。 java:987)
在javax.media.j3d.VirtualUniverse。< clinit>(VirtualUniverse.java:299)
在Hello3d。< init>(Hello3d.java:10)
在Hello3d.main(Hello3d.java:18)

这里快速浏览源代码好。注意:Eclipse被添加为引用库后,Eclipse会自动使用Ctrl + Shift + O自动导入库路径。

  import javax .media.j3d.BranchGroup; 
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class Hello3d {

public Hello3d(){
SimpleUniverse universe = new SimpleUniverse();
BranchGroup group = new BranchGroup();
group.addChild(new ColorCube(0.3));
universe.getViewingPlatform()。setNominalViewingTransform();
universe.addBranchGraph(group);
}

public static void main(String [] args){
new Hello3d();
}
}

我不知道这是什么意思与'j3dcore -ogl'但是在这一点上卡住了。如何在系统环境或IDE项目中安装java3D?请帮助。



IDE:Eclipse SDK 3.5.2



JVM:java-6-sun-1.6。 0.22



操作系统:Ubuntu 10.04 LTS

解决方案

我知道这个问题现在几岁,但这里的答案还不足以解决问题。他们只是部分帮助。 http://www.filsa.net/2008/07/17/eclipse-java3d -and-javalibrarypath / 也是有帮助的,但还不够。因此,我觉得有必要编写一个完整的清单,让Java3D在Eclipse中工作。



几个月前,我已经有同样的问题,我以某种方式解决了它,而没有真正理解我做了什么。今天我想在不同的电脑上设置我的环境,并且猜测什么,我也有同样的问题。我忘了我要做什么?这一次,但是我更系统地解决了问题,现在我明白每一步。



解决方案 - 每一个详细



1)如果要导入别人的项目,请确保正确安装JDK和JRE,在Eclipse中选择。我的Eclipse已经选择了最新的JRE 7.我唯一安装了一个。但是我工作的项目需要JDK 6和JRE 6.如果需要有多个java版本,我建议您在文件系统中使用以下结构




    some / Java / JDK / JDK6 /
  • $ b
  • somePath / Java / JRE / JRE6 /

  • somePath / Java / JRE / JRE7 /



2) strong>在 Eclipse 中,您必须执行以下步骤才能选择正确的JDK和JRE




  • 项目>属性> Java编译器,选中启用项目特定设置,然后为您的项目选择正确的编译器合规级别。在我的情况下,与 JDK6 一起使用 1.6 。 (这个命名对我来说真是令人困惑,至少6是一个提示。)

  • 你还必须确保使用正确的 JRE 运行应用程序。因此打开运行>运行配置,然后选择JRE选项卡。如果您使用JDK 6,那么您必须确保使用JRE 6。如果您点击安装的JRE,然后添加 somePath / Java / JRE / JRE6 / 目录,则可以添加JRE。



3)使您的Java环境正确设置,确保您的计算机上已安装 Java3D 。您不能做任何错误的事情。



4)在您的Java3D安装目录中,找到文件




  • j3dcore-ogl.dll (对于Windows,在Linux上是j3dcore-ogl.so)

  • j3dcore.jar

  • j3dutils.jar

  • vecmath.jar



如果您正确设置环境,这些文件所在的位置无关紧要,我将解释。所以如果你想要的话,你可以将这些文件复制到你的项目目录里,让你拥有一切所需的东西。



5)文件,请确保




  • 在您的操作系统上,将 j3dcore-ogl.dll 的位置添加到 PATH 变量。 .dll或.so文件包含Java3D使用的机器本机代码。您的系统需要注意此代码的存在。
    在Windows下,要设置PATH变量,请在控制面板中打开系统设置,然后选择高级系统设置。在底部,您会找到环境变量按钮。在系统变量列表中,您将找到变量Path。确保j3dcore-ogl的目录包含在路径列表中。

  • 回到Eclipse中,* .jar文件当前位于哪里,请确保它们包含在您的项目>属性> Java构建路径>库。您可以使用添加JAR 添加外部JAR 添加它们,具体取决于您是否将三个JAR复制到项目目录。



6)现在来保存我今天的一天。



对于Java Build Path中列出的每个Java3D库




  • j3dcore.jar

  • j3dutils。 jar

  • vecmath.jar



您需要指定 / strong>即可。本地库是 j3dcore-ogl.dll ,所以编辑本地库位置以指向包含j3dcore-ogl.dll的目录。



我相信,这些都是在Eclipse中设置Java3D必须完成的步骤,因为我今天在一台新电脑上设置了一切。现在我希望这些说明会节省一些其他可怜的Java初学者,学生或程序员的日子: - )


ive ran into some trouble configuring java3D to work with my IDE environment...

I have downloaded j3d-1_5_2-linux-i586.zip, and unpacked j3dcore.jar, j3dutils.jar, vecmath.jar, libj3dcore-ogl.so, libj3dcore-ogl-cg.so and added them all as 'Referenced Libraries' within my project folder. this gets rid of any compilation warnings I was getting but when I compile and run the application I get the following exception!

Exception in thread "main" java.lang.UnsatisfiedLinkError: no j3dcore-ogl in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
    at java.lang.Runtime.loadLibrary0(Runtime.java:840)
    at java.lang.System.loadLibrary(System.java:1047)
    at javax.media.j3d.NativePipeline$1.run(NativePipeline.java:231)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.media.j3d.NativePipeline.loadLibrary(NativePipeline.java:200)
    at javax.media.j3d.NativePipeline.loadLibraries(NativePipeline.java:157)
    at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:987)
    at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:299)
    at Hello3d.<init>(Hello3d.java:10)
    at Hello3d.main(Hello3d.java:18)

here is a quick look at the source code as well. NOTE: Eclipse pulled in the import libraries paths automatically with Ctrl+Shift+O once they were added as Referenced Libraries.

import javax.media.j3d.BranchGroup;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class Hello3d {

    public Hello3d(){
        SimpleUniverse universe = new SimpleUniverse();
        BranchGroup group = new BranchGroup();
        group.addChild(new ColorCube(0.3));
        universe.getViewingPlatform().setNominalViewingTransform();
        universe.addBranchGraph(group);
    }

    public static void main(String[] args){
        new Hello3d();
    }
}

im not sure what im meant to do with 'j3dcore-ogl' but im stuck at this point. how do you install java3D within the system environment or the IDE project? please help.

IDE: Eclipse SDK 3.5.2

JVM: java-6-sun-1.6.0.22

OS: Ubuntu 10.04 LTS

解决方案

I know this question is now a few years old, but the answers here were not enough for me to solve the problem. They only helped partially. http://www.filsa.net/2008/07/17/eclipse-java3d-and-javalibrarypath/ was also a bit helpful, but it was still not enough. Therefore I felt obliged to write a complete checklist to have Java3D work in Eclipse.

A few months ago, I already had the same problem and I somehow solved it without really understanding what I did. Today I wanted to set up my environment on a different computer and guess what, I had the same problem again. And I forgot what I had to do... This time however, I solved the problem more systematically and now I understand every step.

The Solution - every step in detail

1) If you are importing someone else's project, make sure to have the correct JDK and JRE installed and selected in Eclipse. My Eclipse had selected the latest JRE 7. The only one I had installed. But the Project that I work on requires JDK 6 and JRE 6. I recommend the following structure on your file system if you need to have multiple java versions

  • somePath/Java/JDK/JDK6/
  • somePath/Java/JDK/JDK7/
  • somePath/Java/JRE/JRE6/
  • somePath/Java/JRE/JRE7/
  • somePath/Java/Java3D/

2) In Eclipse, you will have to do the following steps to select the correct JDK and JRE.

  • Project > Properties > Java Compiler, check "Enable project specific settings", then select the correct Compiler compliance level for your project. In my case it's 1.6 for the use with JDK6. (The naming was really confusing for me, at least the 6 was a hint.)
  • You also have to make sure that the correct JRE is used when you run the application. Therefore open Run>Run Configurations and select the tab JRE. If you use JDK 6, then you have to make sure that JRE 6 is used. You can add JREs if you click onto "Installed JREs" and then add the somePath/Java/JRE/JRE6/ directory.

3) Having your Java environment set up correctly, make sure that Java3D is installed on your machine. You can't do anything wrong with this.

4) In your Java3D installation directory, locate the files

  • j3dcore-ogl.dll (for Windows; on Linux it's j3dcore-ogl.so)
  • j3dcore.jar
  • j3dutils.jar
  • vecmath.jar

It doesn't matter where these files are located if you setup your environment correctly, which I will explain. So if you want, you can copy these files into your project directory to have everything you need in one place.

5) Having located these files, make sure that

  • On your Operating System, the location of j3dcore-ogl.dll is added to the PATH variable. The .dll or .so file contains machine native code that Java3D uses. Your system needs to be aware of this code's existence. Under Windows, to set the PATH variable, you open the System Settings in your Control Panel and select Advanced System Settings. On the bottom you will find the button "Environment Variables". In the System Variables list you will find the variable "Path". Make sure the directory of j3dcore-ogl is included in the list of paths.
  • Back in Eclipse, wherever the *.jar files currently are, make sure they are included in your Project>Properties>Java Build Path>Libraries. You can add them by either using Add JARs or Add External JARs, depending on whether you copied the three JARs to the project directory or not.

6) Now comes the part that saved my day today.

For each of the Java3D Libraries listed in the Java Build Path

  • j3dcore.jar
  • j3dutils.jar
  • vecmath.jar,

you need to specify Native Library Location. The Native library is the j3dcore-ogl.dll, so edit the native library location to point to the directory containing j3dcore-ogl.dll.

I believe, that these are all steps that must be done to setup Java3D in eclipse, because I set up everything on a fresh computer today. Now I hope that these instructions will save some other poor Java-beginners', students' or programmers' day :-)

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

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