开发者

problems with java3D lib configuration

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 j3dcor开发者_Go百科e.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 :-)


Java is complaining because it cannot find the native libraries (the *.so files) on your system path that Java3D comes with. Exactly how you fix this is up to you. You can do anyone one of the following:

1) Make sure that your system path includes the *.so files provided with Java3D

2) Setup your LD_LIBRARY_PATH environment variable: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/"path-to-java3d-libraries"/

3) Set the java.library.path when executing java: java -Djava.library.path=$LD_LIBRARY_PATH:/usr/lib/"path-to-java3d-libraries"/

To be sure you have things set correctly, add the following to your Java code and make sure the path reported contains the shared libraries on it

System.out.println("LD Library Path:" + System.getProperty("java.library.path"));


I know it's a very old question but some developers are still installing an obsolete version of Java 3D which is harder to use with or without an IDE. Please rather use Java 3D 1.6.0 and follow my detailed instructions (in English and in French) available here.


As an addendum to given answers, what helped me set java 3d was: Copy and paste all the .dll files from "C:\Program Files\Java\Java3D\1.5.X\bin\" to "C:\Program Files\Java\jre6\bin\". So form Java3D to my actual jre6(from bin to bin).

Previously I also set the classpath/(you can also set path) to 3dcore.jar, j3dutils.jar, vecmath.jar, j3dcore-ogl.dll but still did not work.

After copy past j3dcore-ogl.dll (described above) and left classpath to 3dcore.jar, j3dutils.jar, vecmath.jar (in "C:\Program Files\Java\Java3D\1.5.X\ext\") it worked fine.

I have found help here: http://www.xinapse.com/Manual/install_windows.html Look at the point 2.

Best regards


project/properties/java build path/source tab/expand and select native library location / navigate to i386 folder.


(Windows same problem resolved)

"java.library.path" = PATH = C:\Program Files (x86)\Common Files\Oracle\Java\javapath\
(inside this folder: javaws.exe, javaw.exe,java.exe)

copy: j3dcore-ogl. "dll" to this folder and try!


For netbeans (12.2 here), you have also to add the 3 external libraries dependency (j3dCore.jar, j3dutils.jar, vecmath.jar), but you cannot do the "native library location" addition as mentionned for Eclipse project, so instead you have to :

  • go to your project properties,
  • go in "run" catergory,
  • add in "WM options" the following (adjust the path to yours):

-Djava.library.path="C:\Local\Java\Java3D\1.5.1\bin"

Also add in your system path the correct path to the j3dcore-ogl.dll library, in my case again ' C:\Local\Java\Java3D\1.5.1\bin ' (adjust to yours)

Hope it helps Netbeans users.

Also, the j3d version i installed is old but i needed it to test old project.


Just try to this code, it's help me:

  GraphicsConfiguration config =
       SimpleUniverse.getPreferredConfiguration();

    Canvas3D canvas3D = new Canvas3D(config);


I had the same problem. Solved it setting the Native path:

Properties - java build path - libraties - java3Dlib - Native library location - External folder -----> find the path: ....Java/Java3D/1.5.1/bin or the path where is the file: j3dcore-ogl.dll


SOLVED - JonnyO answer is right.

I am using java 8 on linux, and downloaded from https://java3d.java.net/binary-builds.html (take the linux-amd64 version for an intel 64 bit system).

After unzipping the downloaded file, and then unzipping the contained j3d-jre.zip and adding the jar files to project and the libj3dcore-ogl.so to the jar, it still did not work. I had to add the libj3dcore-ogl.so to the library path. (Lazy as I am, I just copied it to /usr/lib, what is sufficient.)

Now it is working.

PS: Make sure to remove any other j3dcore.jar and j3dutils.jar beforehand.


I had this exact problem and the solution for me (I use eclipse) was to download the 32-bit (i586) (from https://java3d.java.net/binary-builds.html) archive and use those natives.


I recently ran into this same problem, here's how I fixed it:

Run 'strace java filename' and look near the top for lines like "open("/usr/lib/jvm/java-8-oracle/jre/bin/../lib/amd64/libpthread.so" which will tell you what binaries your system is loading.

In my case, it's amd64 that matters.

Go back to the java3d download page and download the binaries for (in this case) amd64 verson and install that. Overwrite the .so files in lib/ext (vecmath, j3dcore, and j3dutils).

Test your java3d program again, it should be working.


I had this problem.

it is enough you download java3d plugin and install it.

in your search engine like Google search "java3d plugin"

and download so install it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜