Reputation: 1071
I inherited all these classes that have no package, and the only way I can make this work is to put all these in the root directory where I run my class program. The issue is that this pollutes the directory and it's not a clean installation. Since these classes were already compiled, I cannot change the package. Is there a way to put these classes in a directory and have Java find them in the classpath?
Upvotes: 2
Views: 58
Reputation: 907
Since you have them only as bytecode, you are using them more or less like a libray. So why not generate a jar file out of them?
jar cf jar-file-name input-files-or-dirs-with-wildcard
Then you can put this jar-file wherever you want, you just need to add it to your classpath and your root-directory is no longer polluted.
Upvotes: 1