opennlp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thilo Götz <twgo...@gmx.de>
Subject Re: Java version
Date Wed, 15 Dec 2010 14:47:42 GMT
On 12/15/2010 15:02, william.colen@gmail.com wrote:
> Hi, Jörn,
> 
> Do you know how to ensure that the java compatibility level? The note at the
> bottom of
> http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html<http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html:>says
> that setting source/target is not enough, but I can't understand what
> they mean with configure the compiler's boot classpath to match the target
> JRE. Do we have to hard code the classpath?

When you consider compatibility, you need to consider byte
code compatibility and library compatibility.  Those are
basically orthogonal issues.  The library comes with the
JDK you're using to compile the code, so to make sure that
your source code is compatible with the 1.5 java libs, you
must use a Java 1.5 JDK in Eclipse.  The easiest way to do
that is to make a 1.5 JDK your default JDK in preferences/
Java/Installed JREs.  Do not fiddle with the individual
projects' reference to the JRE System Library in the
classpath, that way leads only to pain and grief.

Only the byte code compatibility can be ensured with the
compiler JDK compliance settings.

To sum up, if you want your code to be compatible with
Java 1.5, you must ensure 1.5 byte code compatibility
*and* 1.5 library compatibility by compiling with a
1.5 JDK (not 1.6 or higher).

Unfortunately, as far as I know, there is no setting
either in Eclipse or maven that can ensure that you
actually are using a 1.5 JDK and will throw an error
if you don't.  So this is up to the developer, and
accidents happen all the time :-(

--Thilo

> 
> Thanks
> William
> 
> 
> On Wed, Dec 15, 2010 at 10:10 AM, Jörn Kottmann <kottmann@gmail.com> wrote:
> 
>> On 12/15/10 1:03 PM, william.colen@gmail.com wrote:
>>
>>> Hi,
>>>
>>> When I try to load the project from Eclipse, some build errors appear
>>> because the project is set to use Java 1.5, but the code use Java 1.6 API
>>> String.isEmpty for example.
>>>
>>> It is OK to build using command line, but using M2Eclipse it fails to
>>> build.
>>>
>>> Maybe I'm missing something.
>>>
>>> By the way, isn't it better to keep Java 1.5 compatibility?
>>>
>>
>> Yes, that is a little embarrassing, it should have been found
>> while making the 1.5.0 release. I think we should fix it now
>> and ensure that the java compatibility level is enforced during
>> our release process.
>>
>> Can you open a jira for it and fix the code ?
>>
>> Thanks,
>> Jörn
>>
> 

Mime
View raw message