Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

unable to compile servletListener

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am getting the below error when i try compiling MyServletListener..


And i have placed both files (Dog.java and MyServletListener.java) under example folder....
MyServletListener.java

-----------------------------------------------------------------------
Dog.java


Can someone please help me
[ October 14, 2008: Message edited by: renrichard ]
 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the classpath most likely doesnt include the folder where Dog is.
 
Sheriff
Posts: 67595
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
"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.

bear
JavaRanch Sheriff
 
renu richard
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Or

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
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you please try
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\SL\WEB-INF\classes
 
renu richard
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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 MyServletListener.java
MyServletListener.java:7: cannot access com.example.Dog
bad class file: C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\S
L\WEB-INF\classes\com\example\Dog.class
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
th.
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
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic