title: Java command line error (linux) - Could not find or load main class
body: <p>I know that this a familiar and well-known issue that happens a lot.</p>
  
  <p>Most of the time the issue is that the user did not specify the package if the class is in package. However I made sure that my case is different. </p>
  
  <p>I tried the following</p>
  
  <p>1- I made sure that the all the java files of the project are in the same folder (4 java files one with main class)</p>
  
  <p>2- I made sure that non of the classes are in any packages</p>
  
  <p>Then I tried to run the program as following (It is a storm hello-world example in case you are familiar with it)</p>
  
  <p>1- Compile using the following command (The jar is needed for storm)</p>
  
  <pre><code>javac -classpath ~/Public/apache-storm-0.9.4/lib/storm-core-0.9.4.jar *.java
  </code></pre>
  
  <p>2- Run Main class using the following command (The jar is also needed here otherwise I'll get another error)</p>
  
  <pre><code>java -cp ~/Public/apache-storm-0.9.4/lib/storm-core-0.9.4.jar HelloStorm
  </code></pre>
  
  <p>What I get is the error below</p>
  
  <blockquote>
    <p>Error: Could not find or load main class HelloStorm</p>
  </blockquote>
  
  <p>I double checked that HelloStorm is the name of the main class (with no spelling mistakes)</p>
  
  <p>I am not familiar with running framework from command line .. so I might have missed something, however searching similar problem, reading oracle documentation and trying different approaches did not help unfortunately</p>
  
  <p>What would you be your suggestions?</p>