java - Error when exporting a project with Log4j2 into a JAR -



java - Error when exporting a project with Log4j2 into a JAR -

i'm creating jar file project uses log4j2. have saved log4j2 jars (for core , api) in 'lib' folder under 'src' folder. within eclipse, exported project create jar file , have checked 'lib' folder included/present in jar file.

when run project within eclipse, runs absolutely fine when seek execute jar via cmd prompt, next error:

c:\users\workspace>java -jar connectorclient.jar exception in thread "main" java.lang.noclassdeffounderror: org/apache/logging/log4j/logmanager @ com.client.connectionclient.<clinit>(connectionclient.java:20) caused by: java.lang.classnotfoundexception: org.apache.logging.log4j.logmanager @ java.net.urlclassloader$1.run(urlclassloader.java:372) @ java.net.urlclassloader$1.run(urlclassloader.java:361) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:360) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:357) ... 1 more

the line in code (line 20) causing error is:

private static logger logger = logmanager.getlogger(connectionclient.class);

it seems if log4j2 jars not beingness read. can able help me here please. i've added 2 jars in project's java build path shown in image..

my classpath file (present within project folder) includes 2 jars in questions shown:

<?xml version="1.0" encoding="utf-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.jre_container/org.eclipse.jdt.internal.debug.ui.launcher.standardvmtype/jdk1.8.0_05"/> <classpathentry kind="lib" path="lib/log4j-api-2.0-rc1.jar"/> <classpathentry kind="lib" path="lib/log4j-core-2.0-rc1.jar"/> <classpathentry kind="output" path="bin"/> </classpath>

any help please?

thanks

maybe want export runnable jar file:

and include required libraries:

java eclipse jar log4j2

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -