• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

does "enum" keyword has become a part of java only in Java 1.5?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a simple problem. I have downloaded a open source java project. And i tried to "build" it using Ant tool. The build has failed. And all the errors are related to "enum" keyword saying that "cannot use the 'enum' keyword as a variable.
I want to know whether "enum" keyword has become the part of java only with java 1.5?

Regards
vijay
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.
 
phil shea
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So all the legacy code which has used "enum" as a variable name will not work with Java1.5 with changing the code.
 
phil shea
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, i mean without changing the code
 
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The fix is to change the variable but meanwhile you can compile as follows:

<javac souce="1.4" target="1.4" ...

or

<javac souce="1.4" target="1.5" ...

for 5.0 compliant input/output

<javac source="1.5" target="1.5" ...


In other words, indicate the version of java the source was written in and what your target platform is. Keep in mind that Java 5.0 runs 1.2, 1.3, 1.4 binaries. As you might imagine, 1.5 is a better compiler than 1.4 so using Java 5.0 for all your needs is a very good idea. You can use any input form and generate any output form.
[ August 31, 2005: Message edited by: Rick O'Shay ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic