How to compile class in package?
Posted: Sun May 11, 2003 6:58 am
Dear gurus,
I am trying "package" and struck with the following:-
<Test.java in directory "\test">
import mypackage;
public class Test {
public static void main (String args[]) {
System.out.println("Test");
Test1 test1 = new Test1();
}
}
<Test1.java in directory "\test\mypackage">
package mypackage;
public class Test1 {
public Test1 () {
System.out.println("Test2");
Test2 test2 = new Test2();
}
}
<Test2.java in directory "\test\mypackage">
package mypackage;
public class Test2 {
public Test2 () {
System.out.println("Test2");
}
}
When compiling Test1.java, the following errors occurred:-
E:\test\mypackage\Test1.java:8: cannot resolve symbol
symbol : class Test2
location: class model.Test1
Test2 test2 = new Test2();
^
E:\test\mypackage\Test1.java:8: cannot resolve symbol
symbol : class Test2
location: class model.Test1
Test2 test2 = new Test2();
^
2 errors
Any advice will be appreciated.
Thanks in advance!
Francis
I am trying "package" and struck with the following:-
<Test.java in directory "\test">
import mypackage;
public class Test {
public static void main (String args[]) {
System.out.println("Test");
Test1 test1 = new Test1();
}
}
<Test1.java in directory "\test\mypackage">
package mypackage;
public class Test1 {
public Test1 () {
System.out.println("Test2");
Test2 test2 = new Test2();
}
}
<Test2.java in directory "\test\mypackage">
package mypackage;
public class Test2 {
public Test2 () {
System.out.println("Test2");
}
}
When compiling Test1.java, the following errors occurred:-
E:\test\mypackage\Test1.java:8: cannot resolve symbol
symbol : class Test2
location: class model.Test1
Test2 test2 = new Test2();
^
E:\test\mypackage\Test1.java:8: cannot resolve symbol
symbol : class Test2
location: class model.Test1
Test2 test2 = new Test2();
^
2 errors
Any advice will be appreciated.
Thanks in advance!