aspose file tools*
The moose likes Beginning Java and the fly likes executable jar build by JBuilderX, NoClassDefFoundError!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "executable jar build by JBuilderX, NoClassDefFoundError!!" Watch "executable jar build by JBuilderX, NoClassDefFoundError!!" New topic
Author

executable jar build by JBuilderX, NoClassDefFoundError!!

peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
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

Joined: Oct 27, 2005
Posts: 19538
    
  16

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!).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
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

Joined: Oct 27, 2005
Posts: 19538
    
  16

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

Joined: Mar 15, 2008
Posts: 240
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: executable jar build by JBuilderX, NoClassDefFoundError!!
 
Similar Threads
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError
NoClassDefFoundError