java类加载代码,即使用Eclipse而不使用LISA
我的问题是下面的代码
ClassLoader myClassLoader = ClassLoader.getSystemClassLoader();
Class myClass = myClassLoader.loadClass("com.Calculator.add");
//com.Calculator is the package name.. add is the class name
Object ClassInstance = myClass.newInstance();
Method myMethod = myClass.getMethod(functionName,new Class[] { String.class });
//functionName has the method name of class
output = (String) myMethod.invoke(ClassInstance,new Object[] { "String Argument" });
//as add method has a argument of string
在Lisa MatchScript中,此代码一直工作到
ClassLoader myClassLoader = ClassLoader.getSystemClassLoader();
但是当我在Eclipse中检查相同的代码时,上面的整个代码块工作得非常好
# 1 楼答案
我得到了答案。。 Jar文件将被放置在lib中,而不是HotDeploy中。 classLoader无法从HotDeploy中找到JAR文件