i trying compiling like this...
javac -d classes src/com/example/MyServletContextListener.java
here is the file.......of MyServletContextListener.java
package com.example;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyServletContextListener implements ServletContextListener
{
public void contextInitialized(ServletContextEvent event)
{
ServletContext sc = event.getServletContext();
String dogBreed = sc.getInitParameter("breed");
Dog d = new Dog(dogBreed);
sc.setAttribute("dog", d);
}
public void contextDestroyed(ServletContextEvent event)
{
//nothing to do
}
}
now......i am getting an error......
src/com/example/MyServletContextListener.java:13: cannot find symbol
symbol : class Dog
location: class com.example.MyServletContextListener
Dog d = new Dog(dogBreed);
^
src/com/example/MyServletContextListener.java:13: cannot find symbol
symbol : class Dog
location: class com.example.MyServletContextListener
Dog d = new Dog(dogBreed);
^
2 errors
--------------
here is the Dog.java file which is in same package......please tell me what should i do so that it can access the dog class??!!
package com.example;
public class Dog
{
private String breed;
public Dog(String name)
{
this.breed = breed;
}
public String getBreed()
{
return breed;
}
}
Thanks for your help!