I have been using the below code to load the classes where I knew the package to load.
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
Class<?> myClass = classLoader.loadClass(classNameToBeLoaded);
There is now change in the folder/package structure.
The variable classNameToBeLoaded
can be from any package which I can't know in advance as the class name comes from an user provided Excel sheet.
For example the value of classNameToBeLoaded can be "Utils", "FileValidation" etc as read from Excel file.
This class can be from different packages like "com.iyaffle.utils" or like "com.testing.validation" or anything so.
How can I make the class to be loaded automatically when we don't know the package name?
Other similar thread which does not have concrete answers:
Aucun commentaire:
Enregistrer un commentaire