Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

executable jar build by JBuilderX, NoClassDefFoundError!!

 
peter tong
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can run the application in JBuilder, I build a executable and ensure put all the required jar file and class file in the exectable jar, but when I run the executable jar, the error "NoClassDefFoundError" is prompted, what happen!!

I am 100% sure that the executable jar contain the main class jes_account.jes_main class!!
I feel the executable can't found the class jes_main in package jes_account, but why?
 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is shown if you execute the JAR file from a command window:

That will show you exactly what class cannot be found. Please add that error message here.

My first guess would be that you are using some JBuilder-specific library (I've done that in the past too, which is why I think JBuilder is a bit dangerous). If so, you will either need to remove all references to that library from your code, or ship the library as well (if allowed by the JBuilder license!).
 
peter tong
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when run java -jar xxx.java, the error is shown as follow:

D:\My Projects\FAS\project>java -jar jes_account.jar
Exception in thread "main" java.lang.SecurityException: no manifiest section for
signature file entry com/microsoft/sqlserver/jdbc/SQLServerException.class
at sun.security.util.SignatureFileVerifier.verifySection(Unknown Source)

at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
at sun.security.util.SignatureFileVerifier.process(Unknown Source)
at java.util.jar.JarVerifier.processEntry(Unknown Source)
at java.util.jar.JarVerifier.update(Unknown Source)
at java.util.jar.JarFile.initializeVerifier(Unknown Source)
at java.util.jar.JarFile.getInputStream(Unknown Source)
at sun.misc.JarIndex.getJarIndex(Unknown Source)
at sun.misc.URLClassPath$JarLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(Unknown Source)
at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
at sun.misc.URLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getLoader(Unknown Source)
at sun.misc.URLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

D:\My Projects\FAS\project>

the error message is quite different from double click the jar file or exe!!
 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's because the javaw tool catches the exception for you, and gives a rather bad description most of the times.


Have you signed your JAR file or something? If so, you may have to sign the libraries you are using as well.
 
peter tong
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is "signed your JAR file or something"? I don't know how to sign a jar file, so I think I have not signed any file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic