Java 1.5 Question

jzdziarski

Registered
Does anyone know the "Proper" way to move over the commandline java to 1.5? The little java preferences tool only affects opening a java applet in a browser, but I need java 1.5 to be the default from the commandline. I tried repointing /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK to 1.5.0, but I get a lot of runtime errors when I compile and run a 1.5 application we're developing (which runs fine on *nix or windows machines running java 1.5). Any help would be appreciated.
 
More specifically I get errors like this:

error: error reading /System/Library/Java/Extensions/libJ3D.jnilib; java.util.zip.ZipException: error in opening zip file

The extensions directory isn't changed by repointing the symlink, nor are there any 1.5-specific extensions. I wouldn't think that 1.4 extensions would work on 1.5, so I'm unclear as to whether java 1.5 is "complete". Is the workaround to move the extensions folder out of the way, or does OSX need this for something? I'm really not sure what to do here.
 
Are those JNI files meant for Java 5? I haven't had any problems using Java 5 from the command line, or from Netbeans. Then again, I don't use any JNI code. Perhaps that is the problem and you need to regenerate the JNI libraries?
 
How would you regenerate the libs exactly? Never messed with JNI before.

What did you do to start using java 1.5 from the commandline? Just repoint CurrentJVM ?
 
I just pointed CurrentJVM to 1.5. For the JNI stuff, I think you'll need to recompile the source code. It's been years since I messed with any JNI stuff, and I think that's right.
 
You need to compile that library that you're using, not the Apple stuff. So in your case, you might want to look at recompiling J3D, or what ever library it is that you are using.
 
It's an in-house developed application my development team is working on. Typical web-based stuff - struts, hibernate, Oracle, etc. No 3D whatsoever although that might make it more interesting.
 
It might have imported some j3d stuff even if it isn't using it. I can't imagine why J3D would be required for any normal stuff like struts and hibernate and I have not encountered this problem when running my own Java apps.

I think for now, you may have to just use the Java 1.4 VM. If you need 1.5 features, you could compile using the 1.5 compiler, specify 1.4 as a target (will this work with generics?) and see how things go. Java 1.5 is still under RC status on Tiger, so perhaps filing a bug report will get this sorted out before the final candidate is released?
 
Back
Top