You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Wayne Cannon <wc...@turinnetworks.com> on 2006/10/25 20:52:26 UTC
Using Ant with older Java versions
I'm attempting to convert a Java 1.3project to Ant that has an attribute
named "enum" (Java 1.3 did not have an Enum class) -- "Enumeration
enum;". I have source and target attributes set to "1.3", but still get
the following error message:
warning: as of release 1.5, 'enum' is a keyword, and may not be used as
an identifier
(try -source 1.5 to use 'enum' as a keyword)
What do I need to do to tell Ant and/or javac to not apply this Java 1.5
constraint?
<javac
classpath="${build.classpath}"
srcdir="${src.dir}"
destdir="${bin.dir}"
debug="${build.debug}" ------- "yes"
source="1.3"
target="1.3"
... >
...
</javac>
--Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Using Ant with older Java versions
Posted by Wayne Cannon <wc...@turinnetworks.com>.
I think I've solved the problem. When I use the "executable" attribute,
it starts complaining that the -source command-line parameter isn't
supported. However, when I remove the source="1.3" and target="1.3"
attributes, it stops complaining; so those parameters must be
incompatible with the JDK 1.3's javac. --Wayne
David Jones wrote:
> I believe that the -source and -target parameters are specific to java
> 1.5.
> If you are using the 1.3 compiler, you don't need to try to ensure
> compatibility with 1.3, its automatic.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Using Ant with older Java versions
Posted by David Jones <jo...@gmail.com>.
I believe that the -source and -target parameters are specific to java 1.5.
If you are using the 1.3 compiler, you don't need to try to ensure
compatibility with 1.3, its automatic.
On 10/25/06, Antoine Levy-Lambert <an...@gmx.de> wrote:
>
> Hello Wayne,
> you need to set both executable and fork="true"
> Regards,
> Antoine
>
> Wayne Cannon wrote:
> > True, it's just a warning, however, I've found that if you don't
> > eliminate 100% of the warnings (and not just by suppressing warnings),
> > meaningful warnings are missed that should result in code changes.
> >
> > I suspect "executable" is what I'm looking for, but when I set it to
> > the Java 1.3.1_18 JDK, it begins to complain that "-source" is an
> > invalid command line parameter -- as though my <javac> task is not
> > compatible with Java 1.3. I'll look into it more tomorrow.
> >
> > Thanks to all,
> > --Wayne
> >
> >
> > Scot P. Floess wrote:
> >> I think its just a warning...not that it doesn't compile. I tried it
> >> on my machine (which has JDK 1.5.0_08 installed) and it did compile...
> >>
> >> David Jones wrote:
> >>> Hi,
> >>>
> >>> Source and target define what compatibility to use, not which JDK is
> >>> being
> >>> used. So 1.5 probably just will not allow that to compile. However,
> you
> >>> could tell it to use a different JDK (1.3), using the executable
> >>> option, and
> >>> then it would actually be compiling with that version of java.
> >>>
> >>> That would be my suggestion, rather than trying to for 1.5 to work
> >>> with your
> >>> 1.3 code.
> >>>
> >>> __David
> >>>
> >>> -source <release> Provide source compatibility with
> >>> specified release
> >>> -target <release> Generate class files for specific VM
> >>> version
> >>>
> >>> executable="/opt/java/jdk1.1/bin/javac"
> >>>>
> >>>> On 10/25/06, Wayne Cannon <wc...@turinnetworks.com> wrote:
> >>>>
> >>>> I'm attempting to convert a Java 1.3project to Ant that has an
> >>>> attribute
> >>>> named "enum" (Java 1.3 did not have an Enum class) -- "Enumeration
> >>>> enum;". ...
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
Re: Using Ant with older Java versions
Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hello Wayne,
you need to set both executable and fork="true"
Regards,
Antoine
Wayne Cannon wrote:
> True, it's just a warning, however, I've found that if you don't
> eliminate 100% of the warnings (and not just by suppressing warnings),
> meaningful warnings are missed that should result in code changes.
>
> I suspect "executable" is what I'm looking for, but when I set it to
> the Java 1.3.1_18 JDK, it begins to complain that "-source" is an
> invalid command line parameter -- as though my <javac> task is not
> compatible with Java 1.3. I'll look into it more tomorrow.
>
> Thanks to all,
> --Wayne
>
>
> Scot P. Floess wrote:
>> I think its just a warning...not that it doesn't compile. I tried it
>> on my machine (which has JDK 1.5.0_08 installed) and it did compile...
>>
>> David Jones wrote:
>>> Hi,
>>>
>>> Source and target define what compatibility to use, not which JDK is
>>> being
>>> used. So 1.5 probably just will not allow that to compile. However, you
>>> could tell it to use a different JDK (1.3), using the executable
>>> option, and
>>> then it would actually be compiling with that version of java.
>>>
>>> That would be my suggestion, rather than trying to for 1.5 to work
>>> with your
>>> 1.3 code.
>>>
>>> __David
>>>
>>> -source <release> Provide source compatibility with
>>> specified release
>>> -target <release> Generate class files for specific VM
>>> version
>>>
>>> executable="/opt/java/jdk1.1/bin/javac"
>>>>
>>>> On 10/25/06, Wayne Cannon <wc...@turinnetworks.com> wrote:
>>>>
>>>> I'm attempting to convert a Java 1.3project to Ant that has an
>>>> attribute
>>>> named "enum" (Java 1.3 did not have an Enum class) -- "Enumeration
>>>> enum;". ...
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Using Ant with older Java versions
Posted by Wayne Cannon <wc...@turinnetworks.com>.
True, it's just a warning, however, I've found that if you don't
eliminate 100% of the warnings (and not just by suppressing warnings),
meaningful warnings are missed that should result in code changes.
I suspect "executable" is what I'm looking for, but when I set it to the
Java 1.3.1_18 JDK, it begins to complain that "-source" is an invalid
command line parameter -- as though my <javac> task is not compatible
with Java 1.3. I'll look into it more tomorrow.
Thanks to all,
--Wayne
Scot P. Floess wrote:
> I think its just a warning...not that it doesn't compile. I tried it
> on my machine (which has JDK 1.5.0_08 installed) and it did compile...
>
> David Jones wrote:
>> Hi,
>>
>> Source and target define what compatibility to use, not which JDK is
>> being
>> used. So 1.5 probably just will not allow that to compile. However, you
>> could tell it to use a different JDK (1.3), using the executable
>> option, and
>> then it would actually be compiling with that version of java.
>>
>> That would be my suggestion, rather than trying to for 1.5 to work
>> with your
>> 1.3 code.
>>
>> __David
>>
>> -source <release> Provide source compatibility with
>> specified release
>> -target <release> Generate class files for specific VM version
>>
>> executable="/opt/java/jdk1.1/bin/javac"
>>>
>>> On 10/25/06, Wayne Cannon <wc...@turinnetworks.com> wrote:
>>>
>>> I'm attempting to convert a Java 1.3project to Ant that has an
>>> attribute
>>> named "enum" (Java 1.3 did not have an Enum class) -- "Enumeration
>>> enum;". ...
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Using Ant with older Java versions
Posted by "Scot P. Floess" <fl...@mindspring.com>.
I think its just a warning...not that it doesn't compile. I tried it on
my machine (which has JDK 1.5.0_08 installed) and it did compile...
David Jones wrote:
> Hi,
>
> Source and target define what compatibility to use, not which JDK is
> being
> used. So 1.5 probably just will not allow that to compile. However, you
> could tell it to use a different JDK (1.3), using the executable
> option, and
> then it would actually be compiling with that version of java.
>
> That would be my suggestion, rather than trying to for 1.5 to work
> with your
> 1.3 code.
>
> __David
>
> -source <release> Provide source compatibility with specified
> release
> -target <release> Generate class files for specific VM version
>
> executable="/opt/java/jdk1.1/bin/javac"
>>
>> On 10/25/06, Wayne Cannon <wc...@turinnetworks.com> wrote:
>>
>> I'm attempting to convert a Java 1.3project to Ant that has an attribute
>> named "enum" (Java 1.3 did not have an Enum class) -- "Enumeration
>> enum;". I have source and target attributes set to "1.3", but still get
>> the following error message:
>>
>> warning: as of release 1.5, 'enum' is a keyword, and may not be used as
>> an identifier
>> (try -source 1.5 to use 'enum' as a keyword)
>>
>> What do I need to do to tell Ant and/or javac to not apply this Java 1.5
>> constraint?
>>
>> <javac
>> classpath="${build.classpath}"
>> srcdir="${src.dir}"
>> destdir="${bin.dir}"
>> debug="${build.debug}" ------- "yes"
>> source="1.3"
>> target="1.3"
>> ... >
>> ...
>> </javac>
>>
>> --Wayne
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Using Ant with older Java versions
Posted by David Jones <jo...@gmail.com>.
Hi,
Source and target define what compatibility to use, not which JDK is being
used. So 1.5 probably just will not allow that to compile. However, you
could tell it to use a different JDK (1.3), using the executable option, and
then it would actually be compiling with that version of java.
That would be my suggestion, rather than trying to for 1.5 to work with your
1.3 code.
__David
-source <release> Provide source compatibility with specified
release
-target <release> Generate class files for specific VM version
executable="/opt/java/jdk1.1/bin/javac"
>
> On 10/25/06, Wayne Cannon <wc...@turinnetworks.com> wrote:
>
> I'm attempting to convert a Java 1.3project to Ant that has an attribute
> named "enum" (Java 1.3 did not have an Enum class) -- "Enumeration
> enum;". I have source and target attributes set to "1.3", but still get
> the following error message:
>
> warning: as of release 1.5, 'enum' is a keyword, and may not be used as
> an identifier
> (try -source 1.5 to use 'enum' as a keyword)
>
> What do I need to do to tell Ant and/or javac to not apply this Java 1.5
> constraint?
>
> <javac
> classpath="${build.classpath}"
> srcdir="${src.dir}"
> destdir="${bin.dir}"
> debug="${build.debug}" ------- "yes"
> source="1.3"
> target="1.3"
> ... >
> ...
> </javac>
>
> --Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
Re: Using Ant with older Java versions
Posted by "Scot P. Floess" <fl...@mindspring.com>.
Wayne:
This is just a warning...the compilation should have happened. If you
don't want to see the warning, try using <javac ... nowarn="true" />
Wayne Cannon wrote:
> I'm attempting to convert a Java 1.3project to Ant that has an
> attribute named "enum" (Java 1.3 did not have an Enum class) --
> "Enumeration enum;". I have source and target attributes set to
> "1.3", but still get the following error message:
>
> warning: as of release 1.5, 'enum' is a keyword, and may not be used
> as an identifier
> (try -source 1.5 to use 'enum' as a keyword)
>
> What do I need to do to tell Ant and/or javac to not apply this Java
> 1.5 constraint?
>
> <javac
> classpath="${build.classpath}"
> srcdir="${src.dir}"
> destdir="${bin.dir}"
> debug="${build.debug}" ------- "yes"
> source="1.3"
> target="1.3"
> ... >
> ...
> </javac>
>
> --Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org