Re: Compiler incompatibility?




"Jean-Francois Briere" <jfbriere@xxxxxxxxx> wrote in message
news:1146337153.638303.61540@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The ANT javac task uses the JDK compiler. You must use a 1.4 version of
the JDK I guess.
The Eclipse project in the other hand uses the Eclipse compiler, which
must be set to 5.0 compliance level I guess.
Every time you save a .java file in your project it automatically
rebuild with the Eclipse compiler.
But when you start the execution of the ANT script in your project or
from the command line you use the JDK compiler and it can lead to
dependent .class files mismatch.
Two questions to be answered first:

1- In Eclipse:
From the menu: 'Window' / 'Preferences...'
In the window, left side: expand 'Ant' then click on 'Runtime'
On the right side: expand 'Global Entries'
*** What do you see? Do you have a tools.jar in it? Does it come from a
JDK 1.4? Else? ***

Yes, I have a tools.jar, specifically D:\Java\jdk1.5.0_06\lib\tools.jar.

2- In Eclipse:
From the Package Explorer window: right-click on your project then
select 'Properties'
In the window, left side: click on 'Java Compiler'
*** On the right side, what is the compiler compliance level? ***


All of the JDK Compliance section is greyed out ("Enable project specific
settings" is NOT checked). However, but the compiler compliance level is
clearly 5.0. By the same token, in Windows/Preferences/Java/Compiler,
Compiler Compliance level is 5.0 and "use default compliance settings" is
checked.

Also, the value of the compiler parameter in my Ant javac task is "modern".

--
Rhino


.



Relevant Pages

  • Re: toward accurate -target
    ... This allow the compiler to ... check signatures AUTOMATICALLY for accurate targets. ... format is designed fortransporting classes, ... But I suppose you coudl add the -target info into an ordinary JDK ...
    (comp.lang.java.advocacy)
  • Re: Bytecode question
    ... if source code written to the 1.4 standard is compiled is with the JDK 1.5 compiler the result can't be run in a 1.4 JVM. ... martin@ | Martin Gregorie ...
    (comp.lang.java.programmer)
  • Re: What kinds of things could cause a class annotations to not be available?
    ... JDK version 1.5, and was formalized through JSR-269 and integrated ... user-customizable annotation processing was separated from the compiler ... the class file, using JD-GUI to examine the class file. ...
    (comp.lang.java.programmer)
  • Re: Bytecode question
    ... if source code written to the 1.4 standard is compiled is with the JDK 1.5 compiler the result can't be run in a 1.4 JVM. ... you just rebooted the previous running version and kept the service running. ... martin@ | Martin Gregorie ...
    (comp.lang.java.programmer)
  • Re: RELENG_7 and diablo-jdk
    ... The JDK's hotspot compiler digs pretty deep into the system to compile Java ... which the JDK uses without going through libc as a wrapper ... The workaround is simply to install one of the Sun JDKs from sources directly, ... bundled with any JDK and doesn't cause the Diablo JDK to segfault when run), ...
    (freebsd-questions)