I want to load a class dynamically which is not in a jar file but in a folder called Dinamics. Here is my code
URL urlOfClass=new File("Dinamics/").toURI().toURL();
URL[] classUrl=new URL[]{urlOfClass};
System.err.println(urlOfClass);
Class myClass=new URLClassLoader(classUrl).loadClass(command1);
myClass.getDeclaredConstructor(String.class).newInstance(command2);
This is the printed urlOfClass
......ha/Documents/NetBeansProjects/Project2.0/Dinamics/
And I get this error message
java.lang.ClassNotFoundException: MyClassName
What did I do wrong here?