Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

Same package files cannot access each other

Thread view: 
anshul - 23 Jan 2007 17:10 GMT
Hi,
i have 2 java files in the package "a.b.c"
Here is a sample snippet of their code:

ValidateIOF.java

package a.b.c;
public class ValidateIOF
{
...
}

The second class creates the object of the above class and uses it. It
is defined in the same package
IOFValidation_Main.java

package a.b.c;
import a.b.c.ValidateIOF

public class ValidateIOF
{
...
ValidateIOF viof = new ValidateIOF();
...
}

I know that the import statement is not really reqd.
But when I compile the IOFValidation_Main it gives me the errror:

IOFValidation_Main.java:2: cannot find symbol
symbol  : class ValidateIOF
location: package a.b.c
import a.b.c.ValidateIOF;

I am not sure how to set my classpath, if I have to, for this.
Can you throw some light on this problem?
Regards
Daniel Pitts - 23 Jan 2007 21:38 GMT
> Hi,
> i have 2 java files in the package "a.b.c"
[quoted text clipped - 33 lines]
> Can you throw some light on this problem?
> Regards

Uhm...

// mypack/A.java
package mypack;
class A {
}

//mypack/B.java
package mypack;
class B {
   A a;
}
--
javac mypack/B.java
Signature

Works for me.

ali - 24 Jan 2007 07:17 GMT
> Hi,
> i have 2 java files in the package "a.b.c"
[quoted text clipped - 31 lines]
> Can you throw some light on this problem?
> Regards

it is about setting your class path i had this problem before just add
;. in the end of the class path or at the beggining put .; and then
compelete your class path
anshul - 24 Jan 2007 15:21 GMT
I did not have the classpath settings right. Thanks for your prompt
replies!

> Hi,
> i have 2 java files in the package "a.b.c"
[quoted text clipped - 31 lines]
> Can you throw some light on this problem?
> Regards


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.