Executing Jar File in JDK 1.6 giving issues
<p>I have created a simple project in java using eclipse ide to test the log4j functionality.
I need to run the application from the command prompt using the jar tool in java.
The logtest.java file is simple java file which defines a logger as below.
It is referencing a Logger which is in another Jar file. below is directory structure.</p>

<pre><code>package com;

import org.apache.log4j.Logger;

public class logtest {

    private static Logger logger = Logger.getLogger(logtest.class);

    public static void main(String[] args) {
        System.out.println("---------------HIIIIII-----------");
    }
</code></pre>

<p>Below is the directory structure that i have created in the project in eclipse.</p>

<pre><code>src/com/logtest.java

lib/log4j-1.2.17.jar
</code></pre>

<p>the manifest files entries are as below and i have manually created the maifest file.</p>

<pre><code>Manifest-Version: 1.0
Main-Class: com.logtest
Class-Path: lib/log4j-1.2.17.jar
</code></pre>

<p>The contents of the Jar file are as below which i unzipped using the jar utility.</p>

<pre><code>META-INF/MANIFEST.MF
.project
com/logtest.class
manifest.mf
lib/log4j-1.2.17.jar
.classpath
</code></pre>

<p>I have exported the jar file and when i try to run using the commond java -jar JarTest2.jar i am getting the following error</p>

<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
    at com.logtest.&lt;clinit&gt;(logtest.java:6)

Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
    at java.net.URLClassLoader$1.run(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)
    ... 1 more
</code></pre>

<p>I know its a class not found exception but strange thing is that the same jar when i create using jdk1.5 and run command tool the jar runs successfully and the java class executes without any error.</p>

<p>I have no idea why this is going as everything is the same.</p>

<p>mine is a 64 bit windows 7 machine and the other machine where it is running is a 32 bit XP machine.</p>

<p>Of course the version of eclipse ide is different on both machines.</p>

<p>Can you please let me know is there something wrong about what i am doing or am i missing something else.</p>

<p>Thanks
Vikeng21</p>
