I am currently loading Java classes using Class.forName()
to load it.
clazz = Class.forName("interfaces.MyClass");
But now I want to load classes from different directory, I have tried to set classpath by
clazz = Class.forName("-cp "C:/dir" distantinterfaces.DistantClass");
With no success and ClassNotFoundException
. Full path to distant class is:
C:/dir/distantinterfaces/DistantClass.class
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…