error: as of release 1.5, 'enum' is a keyword

R

ros

Hello,

I am trying to run a simple web application using NetBeans from Marty
Hall's book Core Servlets and JSPs.

This webapp uses a package called Acme which I downloaded. Also in the
webapp I have a number of Applets. But when I try to build the project
it gives me the following error:

Compiling 157 source files to C:\NETBEANS Projects\Core Servlets Sample
\Chapter 14\ShadowedTextApplet\build\web\WEB-INF\classes
C:\NETBEANS Projects\Core Servlets Sample\Chapter 14\ShadowedTextApplet
\src\java\Acme\Psg.java:466: 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)
Enumeration enum = path.elements();
C:\NETBEANS Projects\Core Servlets Sample\Chapter 14\ShadowedTextApplet
\src\java\Acme\Psg.java:467: 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)
while ( enum.hasMoreElements() )

Can anybody advise me what I should modify to run this application?

Thanks in advance.
Ricky
 
N

Nigel Wade

ros said:
Hello,

I am trying to run a simple web application using NetBeans from Marty
Hall's book Core Servlets and JSPs.

This webapp uses a package called Acme which I downloaded. Also in the
webapp I have a number of Applets. But when I try to build the project
it gives me the following error:

Compiling 157 source files to C:\NETBEANS Projects\Core Servlets Sample
\Chapter 14\ShadowedTextApplet\build\web\WEB-INF\classes
C:\NETBEANS Projects\Core Servlets Sample\Chapter 14\ShadowedTextApplet
\src\java\Acme\Psg.java:466: 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)
Enumeration enum = path.elements();
C:\NETBEANS Projects\Core Servlets Sample\Chapter 14\ShadowedTextApplet
\src\java\Acme\Psg.java:467: 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)
while ( enum.hasMoreElements() )

Can anybody advise me what I should modify to run this application?

Thanks in advance.
Ricky

That's just a warning, not an error. It's warning you that usage of enum as an
identifier means that you can't compile the code as version 1.5. To remove the
warning all you need to do is refactor your code to change the identifier
'enum' to a non-keyword.

Presumably you have already specified '-source 1.4', otherwise you would get the
error:
"as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
(try -source 1.4 or lower to use 'enum' as an identifier)"
 
R

ros

That's just a warning, not an error. It's warning you that usage of enum as an
identifier means that you can't compile the code as version 1.5. To remove the
warning all you need to do is refactor your code to change the identifier
'enum' to a non-keyword.

Presumably you have already specified '-source 1.4', otherwise you would get the
error:
"as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
(try -source 1.4 or lower to use 'enum' as an identifier)"

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : (e-mail address removed)
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555

Hello Nigel,

Thank you very much for the explanation and really sorry for the late
reply.

Cheers
Ros
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top