Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes Tomcat : error on token 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 » Products » Tomcat
Bookmark "Tomcat : error on token "enum" ?" Watch "Tomcat : error on token "enum" ?" New topic
Author

Tomcat : error on token "enum" ?

Lalit Nagalkar
Ranch Hand

Joined: Aug 22, 2006
Posts: 47
I tried "ShowHeaders.jsp" in "java servlet and jsp- by falker and jones"
I am getting following error :-
(code works after changing "enum" to any other valid variable name)

Can any one please tell me what's goin on?

THANKS in advance....

----------------------------------------------------------------------

An error occurred at line: 8 in the jsp file: /ShowHeaders.jsp
Generated servlet error:
Syntax error on token "enum", delete this token

An error occurred at line: 8 in the jsp file: /ShowHeaders.jsp
Generated servlet error:
Syntax error on token "enum", invalid Expression

------------------------------------------------------------------------
[ August 23, 2006: Message edited by: Bear Bibeault ]

SCJP 1.4
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Moved to the Tomcat forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

What JDK are you using? It could because enum is a keyword.


GenRocket - Experts at Building Test Data
Lalit Nagalkar
Ranch Hand

Joined: Aug 22, 2006
Posts: 47
i am using jdk 1.5/tomcat 5.5

If enum is keyword how come the authors made mistake
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

it means that main author used enum as a variable name and in java 5 enum is a keyword, so it return a compiler error as it is in violation ith language rules (the book is not for tomcat 5.5 and java 5)

you can use tomcat 5.5.x with an older jdk to compile the code with no error.
but you will need tomcat compatibility pack to use tomcat 5.5 with jdk 1.4.x

hth


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
Lalit Nagalkar
Ranch Hand

Joined: Aug 22, 2006
Posts: 47
Thank you Mr. Masoud Kalali for this thorough explanation
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Tomcat : error on token "enum" ?
 
Similar Threads
How do I solve the problem:Syntax error on tokens, delete these tokens?
org.apache.jasper.JasperException: Unable to load class for JSP exception while navigating to jsp
Exception thrown org.jboss.util.NestedSQLException
Generics in scriptlets
Two small problems I can't seem to be able to fix