commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wm.A.Stafford" <staff...@marine.rutgers.edu>
Subject Re: Using apache.commons.cli with Java 1.4.2
Date Mon, 15 Jun 2009 14:39:41 GMT
I'm jumping in sort of late on this, but here goes. 

To locate local config issues do the following.

Create a simple script, call it 'view_cpath.bat', to invoke your app and 
output the classpath before the line that calls your app.

------ begin script (windows batch file example):
echo classpath=%classpath%
java my.org.myapp %*
-----  end script

invoke your app with view_cpath.bat ... normal arg list ...

With classpath in hand, check the following:
1. is the cli jar file explicitly named in the classpath?  *.jar will 
not work.
2. is the jar file actually in the place where the classpath says it 
should be?  Use dir or ls on classpath entries to be sure.
3. check for misspellings of the jar file name in classpath.  The 
spelling is relative, obviously both classpath entry and actual jar file 
must be spelled the same.  Commons jar files have lots of '-' and '.', 
it is easy to get them wrong.  I've done it many, many times!

This will find the problem is it is just local configuration.

To make sure you are using the correct jar file do the following.
use 'jar tvf  commons-cli-1.1.jar' (from the directory that contain the 
jar file) to view the contents of the jar file.  In the output you 
should see something like:

423 Wed Jul 04 19:48:06 EDT 2007 
org/apache/commons/cli/CommandLineParser.class

If you don't see this you have a bad/wrong jar file.  Try downloading again.

Hope this helps,
-=beeky



esharris wrote:
> This the only message:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/commons/cli/CommandLineParser.
>
> I only have 1.4.2 java on my machine.
>
> Earl
>
> Emmanuel Bourg-3 wrote:
>   
>> esharris a écrit :
>>
>>     
>>> IMHO, NoClassDefFoundError is hard to debug.
>>>       
>> Could you paste the full stack trace? Also, check that the code was 
>> compiled with -target 1.4
>>
>> Emmanuel Bourg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message