Same package files cannot access each other

A

anshul

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
 
D

Daniel Pitts

anshul said:
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

Uhm...

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

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

ali

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top