This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Symbol not found

 
john sayeau
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I'm trying to get a class to compile but it keeps getting Symbol not found:

Here is the directory tree of the project under /usr/tomcat/webapps/




here is the dog class :



Here is the class I'm tring to compile:



I try to compile it with this command:

javac -classpath WEB-INF/classes/com/example/:/usr/tomcat/lib/servlet-api.jar WEB-INF/classes/com/example/MyServletContextListener.java


and get this:

WEB-INF/classes/com/example/MyServletContextListener.java:10: cannot find symbol
symbol : class Dog
location: class com.example.MyServletContextListener
Dog d = new Dog("dogBreed");
^
WEB-INF/classes/com/example/MyServletContextListener.java:10: cannot find symbol
symbol : class Dog
location: class com.example.MyServletContextListener
Dog d = new Dog("dogBreed");


I've tried variations of the commad. I don't quite understand the arguments for -classpath I guess.





 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
john sayeau wrote: ...I try to compile it with this command:

javac -classpath WEB-INF/classes/com/example/:/usr/tomcat/lib/servlet-api.jar WEB-INF/classes/com/example/MyServletContextListener.java
...


Your Dog class is part of the package com.example, so its qualified name is "com.example.Dog," which is in the directory "classes." That's the directory you should specify in your classpath.

For reference, see Understanding the class path and package names.
 
john sayeau
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! That did the trick.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic