commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From esharris <eshar...@mac.com>
Subject Re: Using apache.commons.cli with Java 1.4.2
Date Mon, 15 Jun 2009 21:41:22 GMT



esharris wrote:
> 
> 
> 
> beeky wrote:
>> 
>> 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
>> 
>> 
>> 
> 
> Initially, there was no CLASSPATH. I added the long name of the
> commons-cli-1.2.jar to the class path. The execution of the bat file
> displayed the expected class path. But this didn't solve the problem. I
> also introduced a JAVA_HOME environment variable that has the path to the
> jdk.
> 

If I put both jars in the same directory, extract everything out of the
jars, and do a "java {path to main class}", it works.

IMHO, my ability to set the class path to a jar is broken. And my ability to
set the class path to something besides the current directory is broken.
-- 
View this message in context: http://www.nabble.com/Using-apache.commons.cli-with-Java-1.4.2-tp23962584p24042102.html
Sent from the Commons - User mailing list archive at Nabble.com.


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


Mime
View raw message