• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use class in same package

 
Gaurav Chhabras
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 15481
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic