Re: Minimal javac java Example (stand-alone) / classpath hell
Wolfgang Fahl <[email protected]> Fri, 25 Mar 2011 07:48:06 +0100
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Organization | BITPlan GmbH |
| Message-ID | <[email protected]> |
Dear Dee, you might want to go from the Subversion content which has Maven support. I'll post the FAQ in a minute and you'll find links in there pointing in = the right direction. Yours Wolfgang Am 24.03.11 23:31, schrieb Dee Ayy: > I am under the impression that httpunit can run stand-alone. What > minimal steps do I need to take to build and run Example.java from my > own path, so that I know I'm not corrupting the httpunit project > files? > > This is what I've done, but am getting java.lang.NoClassDefFoundError > > 1) Download http://prdownloads.sourceforge.net/httpunit/httpunit-1.7.zip?= download > (link on http://httpunit.sourceforge.net/ page "Download 1.7") > 2) Expand httpunit-1.7.zip into its own folder ~/Downloads/httpunit-1.7 > 3) Open shell and cd to ~/Downloads/httpunit-1.7 > 4) Run ant jar > 5) Run ant run-example > Assumed httpunit is good to go. Let's start custom "Hello World" > 6) Copy httpunit-1.7/examples/Example.java to ~/custom/Example.java > 7) cd ~/custom > 8) javac -version > javac 1.6.0_24 > 9) javac -classpath ~/Downloads/httpunit-1.7/lib/httpunit.jar Example.java > 10) ls > Example.class Example.java > 11) java -version > java version "1.6.0_24" > Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) > Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode) > 12) java -classpath . Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRe= quest > ... > Why did it NOT throw an exception at WebConversation? WebRequest is > later in the Example.java source file. Surely it found the classes? > > 13) java -classpath .:~/Downloads/httpunit-1.7/lib/httpunit.jar Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRe= quest > > 14) java -classpath .:~/Downloads/httpunit-1.7/build/classes/ Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRe= quest > > 15) java -classpath > .:~/Downloads/httpunit-1.7/lib/httpunit.jar:~/Downloads/httpunit-1.7/buil= d/classes/ > Example > Exception in thread "main" java.lang.NoClassDefFoundError: > com/meterware/httpunit/WebRequest > Caused by: java.lang.ClassNotFoundException: com.meterware.httpunit.WebRe= quest > > What steps am I missing? Please keep it minimal. No Tomcat; No more > ant, etc. Can we just use javac and java now that ant run-example > worked? > > I've been trying to avoid using an IDE because I will ultimately run > this on a low power machine. But maybe I can put everything in 1 jar > using Eclipse and eventually do "java -jar Custom.jar" on the low > power machine. Unless I am really close above. > > Thanks. > > -------------------------------------------------------------------------= ----- > 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 > _______________________________________________ > Httpunit-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/httpunit-develop > -- = BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Gesch=E4= ftsf=FChrer: Wolfgang Fahl ---------------------------------------------------------------------------= --- 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