Two Laptop Bag
The moose likes Java in General and the fly likes Problem with Inner Classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem with Inner Classes" Watch "Problem with Inner Classes" New topic

Problem with Inner Classes

kevin bennett

Joined: Aug 22, 2001
Posts: 15
I have an application that uses inner classes for event handling. The app was developed in VisualAge and works fine there, but for performance tuning reasons I am now attempting to compile and run the app outside of VisualAge. Now for the problem...when I try to compile the following class that contains an inner class I get these errors -
D:\RentalManager\rm\ui>javac -classpath d:\RentalManager;d:\RentalManager\rm;d:\
RentalManager\rm\data;d:\RentalManager\rm\table;d:\RentalManager\rm\ui; RMCustom cannot resolve symbol
symbol : class RMCustomerPanel$EventHandler
location: class rm.ui.RMCustomerPanel
private RMCustomerPanel$EventHandler evtHandler;
^ cannot resolve symbol
symbol : class RMCustomerPanel$EventHandler
location: class rm.ui.RMCustomerPanel
evtHandler = new RMCustomerPanel$EventHandler();
2 errors

I don't get it. What's going on? Can anyone help? Thx.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
I think the problem is your classpath.
If you have a class rm.ui.RMCustomerPanel in package rm.ui (that's what the compiler thinks) then the class path should be
-classpath d:\RentalManager;d:\RentalManager\rm\data;d:\RentalManager\rm\table;
Get rid of the extra stuff that is confusing the compiler. If you take them out it should put the inner class in the d:\RentalManager\rm\ui directory because that is where the outer class is located.
All you really need is the d:\RentalManager; which tells the compiler where is the START of the package directories. I guess that you have something usefull in those other directories, but if they are REALLY lower level declarations of what is a really part of a package name - then get rid of them also.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: Problem with Inner Classes
It's not a secret anymore!