tags:

views:

69

answers:

1

Hi All,

I have a java application which required 5 external jar files. I want to run the application from command prompt. I tried following command, but java says - no class def found.

java -classpath ..\lib\velocity-1.6.2.jar;..\lib\log4j-1.2.13.jar;..\lib\JConfigReader.jar;..\lib\commons-lang-2.2.jar;..\lib\comons-collections-3.2.jar com.GB.test.TestServer

then i tried following command -

set CLASSPATH=%CLASSPATH%;C:\Documents and Settings\sjain\workspace\BlingNation\lib\log4j-1.2.13.jar;C:\Documents and Settings\sjain\workspace\BlingNation\lib\JConfigReader.jar;C:\Documents and Settings\sjain\workspace\BlingNation\lib\comons-collections-3.2.jar;C:\Documents and Settings\sjain\workspace\BlingNation\lib\commons-lang-2.2.jar;C:\Documents and Settings\sjain\workspace\BlingNation\lib\velocity-1.6.2.jar;

java com.GB.test.TestServer

It worked and application started. But when i sent a request message to my application, it crashed and threw following error -

Exception in thread "8000" java.lang.NoClassDefFoundError: org/apache/commons/collections/ExtendedProperties
    at org.apache.velocity.runtime.RuntimeInstance.<init>(RuntimeInstance.java:175)
    at org.apache.velocity.app.VelocityEngine.<init>(VelocityEngine.java:60)
    at com.GB.convertor.M360_Response.<clinit>(M360_Response.java:17)
    at com.GB.dto.TCPIPRequest.setRequest(TCPIPRequest.java:56)
    at com.GB.threadspool.RequestWorker.setRequest(RequestWorker.java:44)
    at com.GB.utils.OA_READ_HANDLER.read(OA_READ_HANDLER.java:71)
    at com.GB.in.Server.run(Server.java:137)
    at java.lang.Thread.run(Thread.java:717)

Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.ExtendedProperties at java.net.URLClassLoader$1.run(URLClassLoader.java:299) at java.net.URLClassLoader$1.run(URLClassLoader.java:288) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:287) at java.lang.ClassLoader.loadClass(ClassLoader.java:422) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:325) at java.lang.ClassLoader.loadClass(ClassLoader.java:355) ... 8 more

Can any one help what is going wrong here? I tried but nothing is working.

+4  A: 

Could be because org.apache.commons.collections.ExtendedProperties is found in commons-collections-3.1.jar

but your classpath has a typo comons-collections-3.2.jar

JoseK
thanks a ton...it worked...!! :)