title: Why can I run this file packaged by Maven by specifying the path as argument but not by setting the path permanently in my path variable?
body: <p>So, I was trying to run this command:</p>
  
  <pre><code>java -cp ./target/storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm.starter.ExclamationTopology
  </code></pre>
  
  <p>To run the ExclamationTopology class in ./storm/starter/ but it didn't work.</p>
  
  <p>Then <a href="https://stackoverflow.com/questions/16903185/why-cant-i-run-the-example-from-storm-starter-using-this-command/16905073?noredirect=1#comment24400451_16904295">someone</a> on SO suggested me to change the command to this:</p>
  
  <pre><code>java -cp ./target/storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar:/Users/xxx/storm-0.8.2/storm-0.8.2.jar:/Users/xxx/storm-0.8.2/lib/*:/Users/xxx/storm-0.8.2/conf/s torm.yaml storm.starter.ExclamationTopology
  </code></pre>
  
  <p>And it worked. So I thought that I just had to add those paths to the path variable and that would do it, so I changed my path and this is what it looks like now:</p>
  
  <pre><code>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/xxx/storm-0.8.2/storm-0.8.2.jar:/Users/xxx/storm-0.8.2/lib/*:/Users/xxx/storm-0.8.2/conf/s​torm.yaml
  </code></pre>
  
  <p>But I still can't get the first command running. Can anyone please tell me why?
  What I basically want is to get the first command running; it just somehow needs the correct path set, right? I believe that's exactly what I've done.</p>
  
  <p>EDIT:</p>
  
  <p>This is the error returned in the first command:</p>
  
  <pre><code>$ java -cp ./target/storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm.starter.ExclamationTopology
  Exception in thread "main" java.lang.NoClassDefFoundError: backtype/storm/topology/IRichSpout
  Caused by: java.lang.ClassNotFoundException: backtype.storm.topology.IRichSpout
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  </code></pre>