Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

java.lang.NoClassDefFoundError

  Asked By: Charlie    Date: Jul 14    Category: Java    Views: 920
  

I made a jar file using Intellij IDEA from my project. when I extract the jar
file , it contains some jar files that I used them in my project and a diretory
tree from my package (with compiled classes).
but when I run the jar file I get the following error:


Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/swingx/a
uth/LoginService
Caused by: java.lang.ClassNotFoundException:
org.jdesktop.swingx.auth.LoginService
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Can anybody help with this error?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Willard Washington     Answered On: Jul 14

I found the answer.

(in my solution I added some jar  files that my project  depend on them in
MANIFEST section,is it the right solution?)

<target name="jar" >
<mkdir dir="${gmail.build.jar}"/>
<jar destfile="${gmail.build.jar}/GmailFetcher.jar"
basedir="${gmail.output.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
<attribute name="Class-Path" value="lib/swingx.jar
lib/substance.jar lib/swing-worker.jar lib/forms_rt.jar lib/SwingZX.jar
lib/mail-1.4.2-20081209.230559-10.jar lib/activation-1.1.jar
lib/mysql-connector-java-5.1.6-bin.jar lib/jdynamite.jar
lib/gnu-regexp-1.0.8.jar"/>
</manifest>
</jar>


<copy todir="${gmail.build.jar}">
<fileset dir="${basedir}">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>

<mkdir dir="${gmail.build.jar}/lib"/>
<copy todir="${gmail.build.jar}/lib">
<fileset dir="${basedir}/lib">
<patternset refid="library.patterns"/>
<type type="file"/>
</fileset>
</copy>
</target>

 
Answer #2    Answered By: Emily Brown     Answered On: Jul 14

probably these libraries are not in your classpath.

 
Didn't find what you were looking for? Find more on java.lang.NoClassDefFoundError Or get search suggestion and latest updates.




Tagged: