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

    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 .
    com.amazonservices.mws.orders.samples.ListOrderItemsSample
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/ht
    tpclient/HttpConnectionManager
            at com.amazonservices.mws.orders.samples.ListOrderItemsSample.main(ListO
    rderItemsSample.java:79)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpC
    onnectionManager
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown 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.

    Thanks!

    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 log4j.properties

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,848
    Rep Power
    19

    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
    ./*.jar
    in there as well as the
    .
    So
    -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
    Posts
    129
    Rep Power
    0

    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-27-2012, 11:10 PM
  2. Running Main from Command Line
    By sriram56 in forum New To Java
    Replies: 2
    Last Post: 11-26-2011, 09:27 AM
  3. Replies: 16
    Last Post: 09-17-2011, 02:41 AM
  4. Error While Running Windows Command Line Instruction
    By divs1210 in forum AWT / Swing
    Replies: 5
    Last Post: 04-13-2011, 04:09 PM
  5. Replies: 1
    Last Post: 06-30-2009, 02: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
  •