Sun JVM 1.4.2_8 doesn't work with FC4
Brian G. Anderson
bikehead at amberpoint.com
Tue Jun 21 22:09:25 UTC 2005
I have installed suns java 1.4.2_08 and 1.5.0_7 using jpackage. I have
been using the alternatives command to switch between them. In using
1.4.2 I have run across the following problem where a java program
cannot bind to a socket. I have attached the following simple test
class to show what is going on.
1. compile this class using javac1.4
2. if you execute it using java 1.4 you will get the following exception :
> Exception in thread "main" java.lang.UnsupportedClassVersionError:
> SocketTest (Unsupported major.minor version 49.0)
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
3. If you execute it using the java 1.5 jvm the program will
successfully print the first few bytes of the ssh intro message it
prints on port 22 upon first connection.
Its very strange because most everything else about Java seems to work:
IO, swing, etc. In fact the first time I saw this problem (though I
didn't realize it at the time) was when I ran LimeWire under java 1.4:
the UI comes up and everything seems to work, but it never seems to
connect to the network. After realizing what the problem might be I
restarted LimeWire under 1.5 and it connects fine.
So 1.4.2 has some problem with binding to sockets. Now one might just
advise me to use 1.5, but I have a large set of programs that only
compile under 1.4 (syntax changes due to enum). The '-source=' argument
to javac also doesn't work for me. My current solution is to have the
java_sdk alternative set to 1.4 and the java alternative to 1.5, but
this is very awkward.
My questions to the community are:
1. are others seeing this behavior with 1.4.2?
2. any idea on how to fix it?
3. any better solution on how to mix a 1.4.2 compiler with a 1.5 JVM
Thanks,
Brian
More information about the fedora-list
mailing list