Hi all, I was using jdk1.2.2 (well might sound too old but thats what it is) on my unix system and my code was compiling okay but when I tried it on java1.4 and faced a problem. In java1.4 I think- we have to put classes in a package as we can't use classes in the default package in the other classes which are there in some specific packages. e.g., if I have a directory /usr/home/maulin/java/pk1 and i'm in /usr/home/maulin/java currently. I have A.java in pk1 directory and A class in package pk1. Now, I have B.java in /usr/home/maulin/java directory and B.java is not in any package. A.java is as, package pk1; import B; public class A { public static void main(String[] args) { B b = new B(); } } B.java is as, public class B { }
if I remain in /usr/home/maulin/java and try to compile like, javac pk1/A.java then it complains that it can't find class B. This is using java1.4 if I use java1.2 then it works. Why they dis-allowed the use of 'default' package (B is in default package - the current directory)? Regards Maulin
you can assume I am having current directory in CLASSPATH etc. If I put B.java in package pk2 and create pk2 directory and do 'import pk2.*' in A.java and do things it works.... Regards Maulin
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.