Sorry if this is the wrong forum for this question. I am using Eclipse IDE to build and export an executable jar file. I have a manifest file containing name of Main Class and Class Path. In my simple test case the only jar that needs to be on the class path is the log4j jar. So this is what the Class-Path entry in the manifest contains. Class-Path: log4j-1.2.9.jar Now, when I disable the refs to log4j in my code, the jar executes correctly ie; it finds the main class and executes it. When I enable the log4j references in this class, I get a NoClassDefFoundError, pointing to the log4j class (org.apache.log4j.Logger) I'm referencing. The log4j jar file is included in the executable jar file. I have tried building my jar using an ant script and have the same problem. In reality ant builds a manifest with headings that prevent the VM from finding the main class. That is the reason for my using the Eclipse export feature. BTW: The only header line needed is Manifest-Version: - all the others generated by default by ant, cause the problems mentioned above. There are a million and one instances found by Googling on this issue, but none provide much guidance on this classnofound error. Any help appreciated... TIA.
Joined: Apr 24, 2006
Right after posting this I fixed the problem - but not in the best way. I simply co-located the log4j jar with my executable jar. Now the log4j jar is found by my exec jar. So, clearly it is a class loading issue and there must be something really funky about the Class-Path spec in the manifest. Any comments welcome...