java runtime error NoClassDefFoundError -
java runtime error NoClassDefFoundError -
guy. have question java runtime linking erorr: seek compile jasperreport illustration code in centos.
my set up:
/opt/jasperreports-5.6.0 /opt/apache-ant-1.9.4 /opt/commons-logging-1.1.3/commons-logging-1.1.3.jar
and errors:
~/test/1 localhost $ create run javac -cp "/opt/jasperreports-5.6.0/dist/jasperreports-5.6.0.jar:." jasperreportcompile.java java -cp "/opt/commons-logging-1.1.3/commons-logging-1.1.3.jar:"/opt/jasperreports-5.6.0/dist /jasperreports-5.6.0.jar:."" jasperreportcompile compiling study design ... exception in thread "main" java.lang.noclassdeffounderror: org/apache/commons/logging/logfactory @ net.sf.jasperreports.engine.util.jrloader.<clinit>(jrloader.java:81) @ net.sf.jasperreports.engine.jrpropertiesutil.loadproperties(jrpropertiesutil.java:99) @ net.sf.jasperreports.engine.defaultjasperreportscontext.initproperties(defaultjasperreportscontext.java:94) @ net.sf.jasperreports.engine.defaultjasperreportscontext.<init>(defaultjasperreportscontext.java:71) @ net.sf.jasperreports.engine.defaultjasperreportscontext.<clinit>(defaultjasperreportscontext.java:59) @ net.sf.jasperreports.engine.jaspercompilemanager.getdefaultinstance(jaspercompilemanager.java:197) @ net.sf.jasperreports.engine.jaspercompilemanager.compilereporttofile(jaspercompilemanager.java:539) @ jasperreportcompile.main(jasperreportcompile.java:16) caused by: java.lang.classnotfoundexception: org.apache.commons.logging.logfactory @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) ... 8 more make: *** [run] error 1
i didn't not set global classpath // makefile
javac := javac java := java java_compile_libs = "/opt/jasperreports-5.6.0/dist/jasperreports-5.6.0.jar:." java_runtime_libs = "/opt/commons-logging-1.1.3/commons.logging-1.1.3.jar:${java_compile_libs}" target := jasperreportcompile .phony: clean run all: ${target} ${target}: ${target}.java %:%.java ${javac} -cp ${java_compile_libs} $< run: ${target} $(java) -cp ${java_runtime_libs} $< clean: rm -rf *.class
// jasperreportcompile.java
import net.sf.jasperreports.engine.jrexception; import net.sf.jasperreports.engine.jaspercompilemanager; public class jasperreportcompile { public static void main(string[] args) { string sourcefilename = "~/test/1/a.xml"; system.out.println("compiling study design ..."); seek { jaspercompilemanager.compilereporttofile(sourcefilename); } grab (jrexception e) { e.printstacktrace(); } system.out.println("done compiling!!! ..."); } }
i don't understand why still getting error after added apache commons jar class path. hope can help me out. lot.
i guess filename commons.logging-1.1.3.jar
wrong. must commons-logging-1.1.3.jar
.(not point)
java
Comments
Post a Comment