Java 3D 64 bit problem.

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Java 3D 64 bit problem.

Rajesh
Hi,

I am working on a Java application in which I need to use Java 3D. The computer at home is a 32 bit computer and everything works fine.  (I have Linux system - Ubuntu 12.04 LTS) with Oracle JDK 1.7.0u4 and Java 3D 1.5.2.  In the program I have a JPanel to which I added Canvas3D to show my 3D model.  It works well.

I also work on the program at the Office.  Till recently, I had a 32-bit computer (Win XP) at the Office and the program was working there as well.  Now that computer has been replaced by a 64 bit Windows 7 computer.  In that computer I have 64-bit Oracle JDK 1.7.0u5 installed.  When I tried to run my program at office, it gave an exception saying you can't use 32 bit native dlls.  So I downloaded 64-bit version (amd64) of Java 3D, and replaced all three jars and the dlls with the 64 bit versions.  Now the program compiles and runs without any errors.  But, the Canvas3D object doesn't get added to the JPanel and therefore does not show my model. Not only that.  I have put in a few System.out.println lines in the model file just to see till what point it has reached.  Now the Office computer doesn't even print those to the output window.  The other menu items and the program functions normally, but with no display on the JPanel (it just remains cold grey).

Could somebody please explain this weird behaviour to me.  As I said, the same program works perfectly fine on the home computer (of course with 32 bit libraries).  

Thanks,
Rajesh.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

gouessej
Administrator
Hi

I ran a demo using Java3D on Mageia Linux 1 32 bits and Cent OS 5.3 64 bits without any problem. You don't need to use DLLs or .so, just use the JARs containing the Java classes and those containing the native libraries like I did:
https://www.jogamp.org/bugzilla/show_bug.cgi?id=530#c9

Don't forget to download JOGL 2.0 RC9 (or later) separately, this archive contains all necessary JARs. If I had some time, I would write a tutorial about the use of Java3D.

Please delete any .DLL or .so files that could cause any conflict. You should not have to set the library path anymore. The automatic extraction of native libraries from JARs is less confusing and avoids such conflicts. Let me know whether something is still wrong. Best regards.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

Rajesh
Hi,
Thank you very much for your response.

Please pardon me for being so dumb.  I have downloaded the 7z zip file that you suggested.  I see that there are a lot of jar files and also a lot of .dll and .so files.  My questions are specifically the following:

1. Firstly, what are all the jar files that I should use?  I guess I should be using the three jar files of Java 3D + jogl.all.jar + gluegen-rt.jar + a jar file containing the native libraries for the platform I am targeting.  Is this statement correct?

2. The folder containing the .dlls and .so files says “This folder contains deprecated plain native libraries for platform windows-amd64, please use the native JAR files in the jar folder.”  Ok.  I need to use the “jogl-all-natives-windows-amd64.jar” file.  If I use the natives jar, I don’t need to use any .dll or .so files.  Am I correct in my thinking?

3. I need to use NetBeans and the Rich Client Platform application.  I have a lot of modules in my overall program.  Do I need to create three wrapper modules for Java 3D? One for the three Java 3D jars (say Module A), one for gluegen-rt.jar (say Module B) and the last one for jogl.all.jar (say Module C).  If so, where do I put the natives jar file?

4. What dependencies should I use? Module A depends on Module B and Module B depends on Module C?

5. I don’t know on which machine my program will run.  The computer that runs my program could be Windows or Linux, and could be 32 bit or 64 bit.  In my program, if I create a fourth wrapper module (say Module D) and place all possible native libraries (both Windows and Linux 32 and 64 bit jar files), will it work? Will the program automatically pick up the correct jar file at run time? My apologies, if this question is not a jogl specific one, but a NetBeans one.   If it does, what does this module depend on, or what modules should depend on this module?

Thanks you for your patience.

Regards,
Rajesh.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

gouessej
Administrator
Hi

You're welcome. Your first statement is correct. Your second one is correct too as jogl-all-natives-windows-amd64.jar already contains the required native libraries but don't forget the JAR containing the native libraries of GlueGen.

Actually, I rarely use Netbeans. I would do the same thing than with Eclipse, I would create a module for JOGL, another one for GlueGen and a module per architecture/Java module (JOGLLinux32, JOGLWin32, JOGLWin64, GlueGenWin32, ...). Your module D would be nice and would probably work (but I have never tested it), yes JogAmp APIs try to pick up the right native libraries, that's a cool feature, isn't it?

I use JOGL in Netbeans by this way even though it is less clean that what you suggest:
http://tuer.sourceforge.net/download.php

Don't hesitate to catch one of us on our official XMPP chatroom.

Best regards.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

Rajesh
Ok.  This is what I did:
1.  Downloaded 1.6.0 version of Java 3D (three jars) from github..hharrison (or whatever that site was).
2.  Created a wrapper module (Module A) called java3d in my program and placed the three modules into it. Copied the natives jars into a folder called /releases/modules/lib/x86 folder.
3.  A second wrapper module (Module B) called gluegen. --> contains gluegen-rt.jar.  placed the gluegen-natives jar into /releases/modules/lib/x86 folder of that module.
4.  Third wrapper module (Module C) called jogl.  Placed the jogl.all.jar into it.
5.  Dependencies:  A depend on C and C depends on B.  My programs depend on Modules A, B and C.
6.  Removed all previous .dll and .so files.

I get the following exception.  What am I doing wrong?

java.lang.ClassNotFoundException: com.jogamp.common.nio.Buffers
        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:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:262)
Caused: java.lang.ClassNotFoundException: com.jogamp.common.nio.Buffers starting from ModuleCL@77696b[org.j3dapp.j3d] with possible defining loaders [ModuleCL@10496f0[org.j3dapp.gluegen]] and declared parents [ModuleCL@1641ab1[org.j3dapp.jogl]]
        at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:264)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
Caused: java.lang.NoClassDefFoundError: com/jogamp/common/nio/Buffers
        at javax.media.j3d.JoglPipeline.<clinit>(JoglPipeline.java:4307)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:71)
        at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:59)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:88)
        at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:924)
        at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:289)
        at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3857)
        at org.j3dapp.collectors.ModelTopComponent.componentOpened(ModelTopVomponent.java:272)
[catch] at org.openide.windows.WindowManager.componentOpenNotify(WindowManager.java:307)
+ a lot of other lines....

Regards,
Rajesh.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

gouessej
Administrator
Java3D directly depends on GlueGen too. Therefore, A depends on B.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

Rajesh
Thanks.  

When I made A to depend on B as well, I get the following.  I am very close to reaching my destination I think.

java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
        at java.lang.Runtime.loadLibrary0(Runtime.java:845)
        at java.lang.System.loadLibrary(System.java:1084)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:353)
        at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:58)
        at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:89)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:227)
        at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:390)
        at com.jogamp.common.os.Platform$2.run(Platform.java:240)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:225)
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:171)
        at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:90)
        at jogamp.opengl.ThreadingImpl$1.run(ThreadingImpl.java:90)
        at jogamp.opengl.ThreadingImpl$1.run(ThreadingImpl.java:74)
        at java.security.AccessController.doPrivileged(Native Method)
        at jogamp.opengl.ThreadingImpl.<clinit>(ThreadingImpl.java:73)
        at javax.media.opengl.Threading.disableSingleThreading(Threading.java

I have tried to put the line "run.args.extra=-J-Djava.library.path=../GlueGen/release/modules/lib" into my modules.  But somehow it still gives me the same error.

Regards,
Rajesh.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

gouessej
Administrator
You must not set the library path as you don't use the DLLs. The JAR containing the native libraries for GlueGen must be in the same directory than the JAR containing class files for GlueGen, otherwise it won't load the native libraries.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

Rajesh
Sorry Julien,

I just can't get this to work.  Once I shift all natives to the same folder as the main jars (for both JOGL and GlueGen), I end up with this:

3D [dev] 1.6.0-pre1-daily-experimental daily

SEVERE [global]
java.lang.UnsatisfiedLinkError: jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT1(Ljava/nio/ByteBuffer;)Z
        at jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT1(Native Method)
        at jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT(JAWTFactory.java:37)
        at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:106)
        at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:103)
        at java.security.AccessController.doPrivileged(Native Method)
        at jogamp.nativewindow.jawt.JAWT.getJAWT(JAWT.java:103)
        at jogamp.nativewindow.jawt.JAWTUtil.getJAWT(JAWTUtil.java:155)
        at jogamp.nativewindow.jawt.JAWTUtil.<clinit>(JAWTUtil.java:181)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at javax.media.nativewindow.NativeWindowFactory$1.run(NativeWindowFactory.java:212)
        at javax.media.nativewindow.NativeWindowFactory$1.run(NativeWindowFactory.java:209)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:209)
        at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1355)
        at javax.media.opengl.GLProfile.access$000(GLProfile.java:74)
        at javax.media.opengl.GLProfile$1.run(GLProfile.java:142)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:131)
        at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:160)
        at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:1902)
        at javax.media.opengl.GLProfile.get(GLProfile.java:809)
        at javax.media.opengl.GLProfile.get(GLProfile.java:838)
        at javax.media.opengl.GLProfile.getMaxFixedFunc(GLProfile.java:644)
        at javax.media.j3d.JoglPipeline.getDefaultProfile(JoglPipeline.java:6283)
        at javax.media.j3d.JoglPipeline.getBestConfiguration(JoglPipeline.java:7954)
        at javax.media.j3d.Renderer.doWork(Renderer.java:507)
[catch] at javax.media.j3d.J3dThread.run(J3dThread.java:270)

I just can't understand what more I should do.  I have removed the java.library.path commands.

Regards,
Prasad.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

gouessej
Administrator
If you don't succeed in using modules with JogAmp, why not using the same "method" I use for TUER until some contributors (including me) have some time to provide a nice procedure to do it correctly with modules this time? It would allow you to work with JogAmp and it would let us some more time to help you, you could even contact Netbeans team too.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

Wade Walker
Administrator
Hi Rajesh,

You should be able to put Gluegen and JOGL together in one Netbeans project if you want -- no need for two projects. Have you tried the instructions at http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Eclipse_IDE_project? The files and locations for putting Gluegen and JOGL together in one Netbeans project should be the same as putting them both together in a Eclipse project (just the specifics of which button to click in the IDE will be different, of course).

Or if you want it to be a Netbeans library instead of a project, you can do it as shown at http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#NetBeans_IDE.

Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

Rajesh
Hi,

Thanks to both of you for your responses.

In response to Julien's suggestion.  Yes. I would like to wait till someone comes up with the correct method to create and suggest dependencies for NetBeans RCP applications.  And I would also ask the NetBeans team.  The method you suggested (TUER) is for creating a new project with existing sources.  However, that method will not fit me because I am doing an RCP App, where the things are modularised (please correct me if I am wrong).

Wade Walker's message: What I have done is that I have now removed both GlueGen and JOGL modules from my program and I have created only one module with all jars placed into it.  gluegen-rt and its all possible native jars + jogl.all.jar + all its possible native jars are in this module.  Java 3D module only depends on this module.  All my program modules depend on both these modules.  When I run the program, the program runs without any errors, but my first problem has returned.  The Canvas3D object (please refer to my first post) doesn't get added to the JPanel object and therefore there is no display (this is now on my home computer 32-bit). In addition, the program seems stuck somewhere.  My menu items and other functions of the program are not working.  I had to kill the process to terminate the program.

Now to the specifics.  I have been researching over the last one week and now have found that in NetBeans, it is pretty simple to use 32 and 64 bit dlls or .so files.  Just create two folders ( x86 and amd64 ) under release/modules/lib folder and place the dlls or .so files in their respective folders and NetBeans automatically picks up the correct native file during run time.  I am ok with using .dll or .so files.  Because I am not really doing anything fancy with Java 3D.  I only need to show the model to the user and permit the user to have a few simple mouse and keyboard behaviours.  That's all.  The user has to enter a few values into some windows and get the results. To sum it up, I am happy with Java 3D 1.5.2, and prefer to use it compared to 1.6.0 and ten more jar files.  And please I request an answer to my original question - why on my office computer (64 bit), the program was able to run, but not add the Canvas 3D object to JPanel?

Thanks again for your patience going through this long post.  

Regards,
Rajesh.
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

Wade Walker
Administrator
Hi Rajesh,

This may not be completely helpful since you're using NetBeans instead of Eclipse, but I've got a tutorial for how to use JOGL in an Eclipse RCP application at http://wadeawalker.wordpress.com/2010/10/09/tutorial-a-cross-platform-workbench-program-using-java-opengl-and-eclipse/. It shows how to use the "raw" .dll/.so/.jnilib files, instead of the native JAR files, since Eclipse has its own system for loading native libraries. It sounds like NetBeans has a similar system, so some of the ideas in that tutorial may carry over to your situation.

As to the other parts of your question, sorry, I don't know the answers
Reply | Threaded
Open this post in threaded view
|

Re: Java 3D 64 bit problem.

gouessej
Administrator
In reply to this post by Rajesh
Hi

Wade's suggestion should work with Netbeans too especially if you use OSGI modules instead of Netbeans modules.

The 3 last lines of the method used with TUER & Netbeans can be reused in any project and Wade gave some links to more complete tutorials. In my humble opinion, you could go on working on your project and put GlueGen and JOGL into separate modules later, when some people are able to provide a clear procedure to do it.
Julien Gouesse | Personal blog | Website