views:

48

answers:

2

I'm running a big application and a small part of it includes Java 3D, the problem is many users need to use the code, but it isn't practical for everyone to install Java 3D just to run the application if they aren't even going to use that section of the application.

Is it possible through compiling an extra jar, or changing some paths, to include Java 3D in a project without installing it on a system? Or perhaps to manually include any dlls?

+2  A: 

The demos at java3d prove that it is possible. You only need to include the required jar files to your projects distribution.

stacker
A: 

Yes, it is possible. You will need to pull the required jars and native libraries from the java3d site. I pulled them from the java3d demos, but that requires digging through the xml launch descriptor files.

The place you'll run into the most trouble is when linking to the .so / .dll files. This is typically specified on the classpath before your app starts, but since you don't know what platform you're using until your app starts, it's a catch22.

There are two possible solutions: 1. Bootstrap your program with a simple class that detects the platform and sets up a new jvm (with the proper libraries specified) for the real application. 2. Dynamically load the libraries (I've never actually used this method for native implementations, but I see no reason why it wouldn't be possible).

Unfortunately, neither method is terribly straight forward.

Jim
Thanks for the input, I'm going to see what I can do with the Jars and Dlls... Right now I can build and run the application from a binary without crashing or getting a compiler error if the system doesn't have J3D, but once they try and access the J3D section it'll throw exceptions.
Kyle
Hey Kyle,That's because you have linked the java wrapper, but haven't linked the native code. Thus, the JVM doesn't blow up until it tries to load the native code (upon first use).
Jim