HI everybody,
I have a weird problem. I have written a java code, which compiles and runs fine on eclipse. However I wanted to run it outside of an ide. i wanted to compile and run it from command prompt. So i used an ant script which compiled and packaged my class files for me. However when i tried to execute the class file generated it gives the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: RunApplication (wrong
name: common/RunApplication)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(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)
Please tell me what i am doing wrong!
Further details are as under:
My java source code has the following structure:
src(main folder)
---common(sub folder)
------RunApplication.java
My class files has the following structure:
bin(main folder)
---common(sub folder)
------RunApplication.class
the command i use is
cd bin;
cd common;
java RunApplication
My RunApplication.java is as under
}
I have a weird problem. I have written a java code, which compiles and runs fine on eclipse. However I wanted to run it outside of an ide. i wanted to compile and run it from command prompt. So i used an ant script which compiled and packaged my class files for me. However when i tried to execute the class file generated it gives the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: RunApplication (wrong
name: common/RunApplication)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(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)
Please tell me what i am doing wrong!
Further details are as under:
My java source code has the following structure:
src(main folder)
---common(sub folder)
------RunApplication.java
My class files has the following structure:
bin(main folder)
---common(sub folder)
------RunApplication.class
the command i use is
cd bin;
cd common;
java RunApplication
My RunApplication.java is as under
}