I have a situation where I need to compile classes dynamically.
Following is the structure in which my java classes have been organized.
// no package
public class A{
}
package test ;
public class B{
A obj;
//other java code
}
where A is a class with default package, and B is a class with package name test. B has A as a attribute.
Files are saved in their respective folders( as per package )
I fail to compile this with JAVA Compiler API.
You cannot refer to classes in the default package from classes in other packages. This has been the case since 2001. See the Release Notes for Java 1.4.