Hi,
My code below :) -
String parserConfigurationClassName = this.cli.getParserConfigImpl();//Gets implementation's name as a string
Class parserConfigurationClass;
try {
parserConfigurationClass = Class.forName(parserConfigurationClassName);
}
catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Failed to load parserConfigImpl [" + parserConfigurationClassName + "]: Class not found");
}
So as you can see, I am trying to create the object of the class which i get as a string , and try to create the object of that class using Class.forName(String)
but it throws ClassNotFoundException
.
I go this in the sun's documentation as :-/ =>
forName
Throws:
LinkageError - if the linkage fails
ExceptionInInitializerError - if the initialization provoked by this method fails
ClassNotFoundException - if the class cannot be located
So it means if the jvm could not locate the class then it wil throw the class not found exception, but here i can i created the class ans can also see the compiled clasfile for the same, that too in proper directory.
So plz help me toi figure out the reason behind this, which has stopped my development work completely.:'(
Thanks & regards,
Multicoder