here main, p1,p2 and p3 are packages. if i want to modify classpath for the above classes, i need to do like this:
Here all p1,p2 and p3 are subpackages of "main" package. And when the number of subpackages becomes large, the classpath becomes a big list (like a paragraph!!). Is there any way simplify this i.e to include all subpackages of main package.
If so, you don't need to add all those sub folders to the class path - c:\proj\ is enough. When the JVM needs to load class main.p1.Class1, it will try looking for a file main\p1\Class1.class relative to all folders in the class path. So if your class path includes ".", "D:\" and "c:\proj\", it will try ".\main\p1\Class1.class" first, "D:\main\p1\Class1.class" next and finally ""c:proj\main\p1\Class1.class".
I tried many ways. By fluke, a dot (".") solved the problem. i.e, the main package is "main" under c:\proj\ folder. p1, p2 and p3 are under this "main" package. I set classpath like the one below (added a dot after "c:\proj\") which solved the problem:
This includes all sub folders (sub packages) to the classpath.