FineReport V10.0插件开发配置工程。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1.4 KiB

package com.fr.learn;
import com.fr.log.FineLoggerFactory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Learner {
static {
// 这段代码让插件能支持远程设计的时候的调试
String workDir = System.getProperty("user.dir");
System.setProperty("fine.plugin.home", workDir + "/webroot/WEB-INF/plugins");
}
public static void main(String[] args) {
try {
Class mainClass = Class.forName("com.fr.start.MainDesigner");
invokeMain(mainClass, args);
} catch (ClassNotFoundException e) {
// MainDesigner找不到,走以前的Designer
try {
Class oldMainClass = Class.forName("com.fr.start.Designer");
invokeMain(oldMainClass, args);
} catch (ClassNotFoundException ex) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
private static void invokeMain(Class clazz, String[] args) {
try {
Method method = clazz.getMethod("main", String[].class);
Object[] param = new Object[] {args};
method.invoke(clazz, param);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}