Results 1 to 3 of 3
  1. #1
    SnakeDoc is offline Senior Member
    Join Date
    Apr 2012
    Rep Power

    Question help with Eclipse class files in Package - running at command line

    I have made a java project that is one large package in Eclipse. I copied the contents of the "bin" folder and the "lib" folder to a new working directory. the "bin" folder as i'm sure you know is the compiled class files from ecplipse. the "lib" folder contains several jar files that are used in my java package (as imports).

    When I attempt to run this program from the command line, i get the dreaded:

    Java Code:
    C:\Documents and Settings\jason.s\Desktop\AMZ_Downloader\demo>java -classpath .
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/ht
            at com.amazonservices.mws.orders.samples.ListOrderItemsSample.main(ListO
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpC
            at$ Source)
            at$ Source)
            at Method)
            at Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            ... 1 more
    i'm not entirely sure why its not running, as i've made sure the package "com.amazonservices.mws.orders.samples" is in the same working directory as all the jar files it needs to run. Can someone help point me in the right direction? My goal is to schedule this program to run every so often using windows task scheduler or similar.


    edit: in case it helps, here's what my working directory looks like:

    Java Code:
    C:\Documents and Settings\jason.s\Desktop\AMZ_Downloader\demo>dir
     Volume in drive C has no label.
     Volume Serial Number is 60D3-6F94
     Directory of C:\Documents and Settings\jason.s\Desktop\AMZ_Downloader\demo
    05/25/2012  10:51 AM    <DIR>          .
    05/25/2012  10:51 AM    <DIR>          ..
    04/17/2012  02:20 PM            54,829 activation.jar
    05/25/2012  10:39 AM    <DIR>          com
    04/17/2012  02:20 PM            46,725 commons-codec-1.3.jar
    04/17/2012  02:20 PM           279,781 commons-httpclient-3.0.1.jar
    04/17/2012  02:20 PM            52,915 commons-logging-1.1.jar
    04/17/2012  02:20 PM            78,850 jaxb-api.jar
    04/17/2012  02:20 PM           826,289 jaxb-impl.jar
    04/17/2012  02:20 PM         3,108,955 jaxb-xjc.jar
    04/17/2012  02:21 PM            46,047 jsr173_1.0_api.jar
    05/25/2012  10:18 AM               376 KickStarter.class
    05/25/2012  10:51 AM    <DIR>          lib
    04/17/2012  02:21 PM           367,444 log4j-1.2.14.jar
    04/24/2012  11:44 AM               749

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: help with Eclipse class files in Package - running at command line

    That classpath will only pick up classes in the current directory.
    It won't pick up the jar files.
    In order to do that you'll need an extra
    in there as well as the
    -cp .;./*.jar
    (Check whether it is a semi colon or a colon for the separator).
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    SnakeDoc is offline Senior Member
    Join Date
    Apr 2012
    Rep Power

    Default Re: help with Eclipse class files in Package - running at command line

    thank you so much! it worked!

Similar Threads

  1. Linux running/compiling from Command Line?
    By arcelivez in forum New To Java
    Replies: 4
    Last Post: 01-28-2012, 12:10 AM
  2. Running Main from Command Line
    By sriram56 in forum New To Java
    Replies: 2
    Last Post: 11-26-2011, 10:27 AM
  3. Replies: 16
    Last Post: 09-17-2011, 03:41 AM
  4. Error While Running Windows Command Line Instruction
    By divs1210 in forum AWT / Swing
    Replies: 5
    Last Post: 04-13-2011, 05:09 PM
  5. Replies: 1
    Last Post: 06-30-2009, 03:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts