This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes does Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "does "enum" keyword has become a part of java only in Java 1.5?" Watch "does "enum" keyword has become a part of java only in Java 1.5?" New topic
Author

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

phil shea
Greenhorn

Joined: Aug 24, 2005
Posts: 12
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Yes.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
phil shea
Greenhorn

Joined: Aug 24, 2005
Posts: 12
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

Joined: Aug 24, 2005
Posts: 12
sorry, i mean without changing the code
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: does "enum" keyword has become a part of java only in Java 1.5?
 
Similar Threads
Is there anything developed in java 4 and not run in java 5?
error: as of release 1.5, 'enum' is a keyword
Basic question on foundational Java
keywords confusion
java 1.4 and 1.5 compatable ?