File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes unable to compile servletListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "unable to compile servletListener" Watch "unable to compile servletListener" New topic

unable to compile servletListener

renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
I am getting the below error when i try compiling MyServletListener..

And i have placed both files ( and under example folder....


Can someone please help me
[ October 14, 2008: Message edited by: renrichard ]

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2068
the classpath most likely doesnt include the folder where Dog is.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63867

"renrichard", you have previously been warned on multiple occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional, and this is your final warning. Adjust your display name to comply with the required standards prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Failure to comply will result in the removal of your account.

JavaRanch Sheriff

[Asking smart questions] [About Bear] [Books by Bear]
renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Hi jesus,

I have set the classpath as "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\SL\WEB-INF\classes\com\example".This is where i have Dog.class file. Even after this also, i am getting the same error.


Do i need to set the classpath simply as "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\SL\WEB-INF\classes"---- since the Dog.clas file is inside the package com.example

Please help me in solving this. Many Thanks
Vishal Matere
Ranch Hand

Joined: Jan 22, 2008
Posts: 81
can you please try
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\SL\WEB-INF\classes

SCJP <br />SCWCD <br />SCBCD <br />SCEA-1
renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
I tried that also. But still i am getting error.

C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\SL\WEB-INF\classe
s\com\example>javac cannot access com.example.Dog
bad class file: C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\S
class file has wrong version 49.0, should be 47.0
Please remove or make sure it appears in the correct subdirectory of the classpa
Dog d = new Dog(dogBreed);
1 error

And JDK version i am using is
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode)
[ October 15, 2008: Message edited by: renu richard ]
renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Hi Vishal,
Many Thanks!!!
Now it's getting compiled after setting "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\SL\WEB-INF\classes" in the classpath.
I agree. Here's the link:
subject: unable to compile servletListener
It's not a secret anymore!