I have a folder with a bunch of classes next to my main class. How would i access those classes? Is it possible?
Thnx
Usually one would use packages. Other than that that directory could be added to the class path.
Hmmm… it works when this folder is in the same derictory as the main class. But it doesnt work when the folder is in a JAR. I have to place all those classes next to the main class inside the JAR then it works.
Well, use packages or just put em all into the same directory.
Oh… ok. Im better at summersaulting than using packages, but thanx anyway. It shouldnt affect performance if all those classes are put in this ugly fashion, should it?
Using packages is pretty easy. I recommend to look that up online.
Putting everything into one directory or not doesn’t affect performance in a measurable way. It should be faster actually, but constructing a benchmark where that actually makes a difference should be pretty much impossible.
The only purpose of packages is organization and avoiding naming conflicts. (Well, there is also that package access modifier, but it’s rarely used.)
Whenever i try using packages, Java starts “losing” classes. Once i tried using EasyOgg package and it didnt work, so i ended up extracting all the stuff and putting it next to main class. Ugly but works. :
As part of learning to use packages, you need to learn how to set up the classpath. Once you understand that, it’s smooth sailing.
actually probably dependent on the amount of classes, the filesystem used etc. It would be pretty non-effective premature optimization. I’ll shutup now 