aspose file tools
The moose likes Beginning Java and the fly likes How to use class in same package Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "How to use class in same package" Watch "How to use class in same package" New topic
Author

How to use class in same package

Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
Hello

I have a page name RegisterForm and i compiled that and it is defined public. I have another page named RegisterAction and i want to make a object of RegisterForm in RegisterAction.

I have written in RegisterAction that -:

RegisterForm rf = (RegisterForm) form;

Then it is giving the error that
RegisterForm ---:: cannot resolve symbol
I have extended the registerAction class with some other class.
What should i do.
Both are in same package.

Regards
Gaurav
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12929
    
    3

If both classes are in the same package and you have the source files in the same directory, you should not be getting the "cannot resolve symbol" error.

Does RegisterForm compile without errors?
Do you have the same package statement in both source files?
Are the source files in the same directory?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
If both the classes belong to the same package and you've got the import statements in place too, then the only reason why you could be facing the "Cannot resolve symbol" problem is that the compiler searches for the "imported" class file in the path specified in your "CLASSPATH". Try appending your CLASSPATH with ";.;" ,this would basically direct the compiler to search in the present working directory for the .class files too.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to use class in same package
 
Similar Threads
taglib in JSP not working in struts
NO Getter method
Whats wrong here? 'PACKAGE'
Flow of execution in struts application
Is UserDirectory a default class