Re: Minimal javac java Example (stand-alone) / classpath hell

Dee Ayy <[email protected]> Fri, 25 Mar 2011 10:45:03 -0500
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
> For that particular example, at a minimum you need:
> java -classpath
> ../Downloads/httpunit-1.7/jars/js-1.6R5.jar:../Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:../Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:../Downloads/httpunit-1.7/lib/httpunit.jar:.
> Example

I had tried what I thought was the above variation:
java -classpath
.:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/jars/activation-1.1.jar:~/Downloads/httpunit-1.7/jars/js-1.6R5.jar:~/Downloads/httpunit-1.7/jars/jtidy-4aug2000r7-dev.jar:~/Downloads/httpunit-1.7/jars/junit-3.8.1.jar:~/Downloads/httpunit-1.7/jars/mail-1.4.jar:~/Downloads/httpunit-1.7/jars/nekohtml-0.9.5.jar:~/Downloads/httpunit-1.7/jars/servlet-api-2.4.jar:~/Downloads/httpunit-1.7/jars/xercesImpl-2.6.1.jar:~/Downloads/httpunit-1.7/jars/xmlParserAPIs-2.6.1.jar
Example
Exception in thread "main" java.lang.NoClassDefFoundError:
com/meterware/httpunit/WebRequest
Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRequest

Why did the above fail?
I list the current directory "." to find my Example.class
Then I list httpunit.jar then the reamining jars, yet you listed
httpunit.jar last.  Does this order matter?

Your export worked!  Thanks.  But I'm still confused.
It seems that "-classpath" does not like relative paths?
MY_JARS now contains absolute paths.  When I manually type absolute
paths it worked.

Thanks for saving me from classpath hell.

Dee

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar