You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@opennlp.apache.org by "william.colen@gmail.com" <wi...@gmail.com> on 2010/12/15 13:03:21 UTC
Java version
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?
Thanks,
William
Re: Java version
Posted by Thilo Götz <tw...@gmx.de>.
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 <ko...@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
>>
>
Re: Java version
Posted by Jörn Kottmann <ko...@gmail.com>.
On 12/15/10 3:02 PM, 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?
>
We had a similar issue over at UIMA, as far as I understand it, the
code must be compiled with a Java 1.5 JDK, which can be achieved
by setting the JAVA_HOME to it.
Maybe the Animal Sniffer plugin can be used to perform these
checks on every built? Does has anyone experience with it ?
Jörn
Re: Java version
Posted by "william.colen@gmail.com" <wi...@gmail.com>.
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?
Thanks
William
On Wed, Dec 15, 2010 at 10:10 AM, Jörn Kottmann <ko...@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
>
Re: Java version
Posted by Jörn Kottmann <ko...@gmail.com>.
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