Java3D Version detection

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

Java3D Version detection

LordSmoke
Is there a way to programmatically detect the Java3D version number?

Writing a simple Java environment probing app for end-users to provide me with debug info. I can currently detect Java3D with some old code I had running:

        // Check for Java3D
        boolean hasJava3D = false;
        try {
            com.sun.j3d.utils.geometry.Sphere sphere = new com.sun.j3d.utils.geometry.Sphere();
            hasJava3D = true;
        } catch (Error e) {
        }

I note that the above spews out the version info to the system console. Not sure if that is something I did in the past or not - doubt it since this is an updated Java3D.

Is there any way to get more specific information on Java3D?

TIA, LS

PS: Looking forward to more Jogl and Java3D programming for some months to come (university sabbatical).
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

philjord
VirtualUniverse provides this via the getProperties() method

So
    String versionString = (String) VirtualUniverse.getProperties().get("j3d.version");
    System.out.println("versionString " +versionString);

Will output something like

versionString 1.7.0_pre2

Note that output is for the 1.7.0 version, which is simplified a little.

If you wrap the VirtualUniverse is a try catch for ClassNotFoundException that will tell you if they have the Java3D jars on the classpath, obviously.

For more info see
https://github.com/hharrison/java3d-core/blob/master/src/javax/media/j3d/VirtualUniverse.java#L552-L582
and
https://github.com/hharrison/java3d-core/blob/master/build-tools/VersionInfo.java#L225
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

gouessej
Administrator
In reply to this post by LordSmoke
Hi

Why not dropping old versions of Java3D by using one of my workarounds?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

LordSmoke
In reply to this post by LordSmoke
Thanks! Philjord's recommendation was just what I needed.

As to gouessei's suggestion, I have a working Java3D app that I will be extending with pure jogl graphics. So, I don't want to do anything with the Java3D for now. I have a few months in which to work almost exclusively on this stuff, so I just wrote this little app to get back into the programming mindset. I will be writing another fairly simple jogl app next to work into that before I tackle the much more complicated integration of the jogl library Lili wrote for me a year or so ago.

I just finished reading the OpenGL Programming Guide 8th Ed. to become familiar with the lingo. Now, working through some simple online tutorials and the jogl online documentation/examples. I could hack away to get things to work, but I want to take this opportunity to build a more solid foundation.

Again, thanks for the help. I am sure I will be pestering more in the not-too-distant future.

Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

gouessej
Administrator
You might still need one of my workarounds under Mac as Apple unfortunately goes on shipping old versions of Java3D with old versions of JOGL. Disabling the extension mechanism or using a JRE with no such feature (OpenJDK 1.9) just works :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

LordSmoke
Oh, yea. Haven't dealt with that in a while since my own systems have been sorted out. I do distribute a shell script to move things around for users of my software. Thanks for the reminder, LS
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

gouessej
Administrator
I hope that your users are a bit technical, otherwise put your script into an APP or DMG package to drive it easier to install. If your stuff is under GPL, feel free to use JNDT.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

LordSmoke
Hmm, as mentioned, I had largely forgotten about this. My users are scientists who should be able to at least run a script. However, in investigating further, I cannot find the old Java3D libraries on my Mac, and cannot remember the last time I moved them out of the search path. I am running OS X 10.11.6 (El Capitan). Might they have been removed from the more recent OS X distributions?

As to GPL, I am currently distributing source (see above) under the Apache 2.0 license, and plan doing the same for all future source releases. I really couldn't appreciate the differences between the various license options, so I picked Apache because I am already using their matrix algebra libraries and they seem to do an acceptable job with OpenOffice. Any reason I should not do so? Would that suffice for JNDT usage?
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

gouessej
Administrator
As far as I remember, Apple Java3D 1.3 and JOGL 1 were still under OS X 10.11, maybe you already removed them earlier.

The GPL is viral unlike the Apache 2.0 license. JNDT injects some parts of itself into the bundles which drives it unusable in non GPL programs. The choice of the license for your own code is entirely up to you. The GPL v3 is compatible with the Apache 2.0 license:
https://www.apache.org/licenses/GPL-compatibility.html
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

LordSmoke
My desktop running 10.11.6 and my just-updated laptop running 10.12 do not have any of the old files. However, my friend, whom I am confident has upgraded to 10.12, shows the old files still in his /System/Library/Java/Extensions directory. All files are dated Jul 6 2015.

On my systems, I had run an app (provided to my users) that moved the troublesome files to a ./hold_j3d subdirectory off of the above, and to be a good citizen, there was also an app that undid the move. I suppose that the directory might have gotten deleted during subsequent upgrades, while my friend's upgrades retained all of the files in the original directory. Though, he has a number of non-related files I do not have. I only have MRJToolkit.jar.

Or might it be that installation of Java updates overwrites the directory? Checking with my friend for further info.
Reply | Threaded
Open this post in threaded view
|

Re: Java3D Version detection

gouessej
Administrator
I don't think that Oracle Java overwrites any directory, it's the same for OpenJDK. If you don't want to move & "unmove" the libraries, just use a command line option in a script to override the extension path of the software instead of modifying your system.
Julien Gouesse | Personal blog | Website