2006/5/16, Boyd Stephen Smith Jr. <[EMAIL PROTECTED]>:
On Tuesday 16 May 2006 02:28, "wu chuanwen" <[EMAIL PROTECTED]> wrote
about 'Re: [gentoo-user] cause jdk1.5 emerge tomcat error!':
> 2006/5/15, Boyd Stephen Smith Jr. <[EMAIL PROTECTED]>:
> > On Sunday 14 May 2006 13:32, "wu chuanwen" <[EMAIL PROTECTED]> wrote

javac compiles .java files into (one or more) .class files.  Multiple class
files plus metadata files are zip'd into a .jar file.

.class files have a very specific format.  In particular there's the
classfile "magic" (0xCAFEBABE) that "confirms" that a file with the .class
extension is really in the classfile format, and can be used to identify
un- or mis-named classfiles.

Further on in the classfile header (before the data specific to the .java
file) is a classfile version.  Different versions of javac write out
different classfile versions.  Presumably to make sure a vm can /safely/
load a class.  In particular, there've been at least 2 version bumps.  One
from somewhere between 1.0 and 1.2 and one between 1.4 and 1.5.  I'm not
sure on the /exact/ chanages associated with each of those bumps.

Each vm has a whitelist of classfile versions it will load.  The default
version output by a 1.5 javac is not on the whitelist for a 1.4 vm.  You
can change the classfile version output with the --target argument to
javac.

Also, javac actually runs inside a vm, and will attempt to load classfiles
that are used by your program, but not available on the source path, in an
attempt to ensure you are using those classes correctly.  The classfiles
must have a version loadable by javac's vm or you get the same error.
Thank you very much!I have learned a lot.

Now my problem is :
I have both jdk1.5 and 1.4 now.
$ java-config -L
[sun-jdk-1.4.2.10] "Sun JDK 1.4.2.10" (/etc/env.d/java/20sun-jdk-1.4.2.10)
[sun-jdk-1.5.0.06] "Sun JDK 1.5.0.06" (/etc/env.d/java/20sun-jdk-1.5.0.06) *
I compiled all the dev-java packages by javac1.5.Now when i compile
commons-pool-1.2-r1,"enum" can't be recognized as a keyword.And when i
switch to jdk 1.4,the message is "UnsupportedClassVersionError".
How can i fix this problem now besides re-emerge all the packages in dev-java?


--
"If there's one thing we've established over the years,
it's that the vast majority of our users don't have the slightest
clue what's best for them in terms of package stability."
-- Gentoo Developer Ciaran McCreesh





--
wcw

--
gentoo-user@gentoo.org mailing list

Reply via email to