I am trying to setup a cronjob to download my daily and weekly reports from iTunes Connect. I have downloaded Apple's Autoingestion.class and I have made the following shell script to download the weekly reports:
java Autoingestion <MyAccountName> <MyPassword> <MyVendorID> Sales Weekly Summary
This shell script is stored inside the same directory as the Autoingestion.class. When I run this shell script inside the directory, it works fine. If I go to another directory and run it, I am getting the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: Autoingestion
Caused by: java.lang.ClassNotFoundException: Autoingestion
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
Could not find the main class: Autoingestion. Program will exit.
Because it does not work when being ran from another directory, my cronjob does not work.
Does anyone have an idea why this happens and if there is anything to do to get rid of it?
classpathwith-cp /path/to/your/stuff? – slhck Oct 22 '11 at 11:06