title: Unable to find or load Main Class in Intellij 2019.4
body: <p>I have been at this problem for a few days now, don't know why it is still happening. I have tried other solutions that have been posted on stackoverflow but no luck. </p>
  
  <p>Below the following code is from the book crafting interpreters in java. </p>
  
  <p>In <code>IntelliJ 2019.4</code> this error always pop up when I am trying to run the <code>.jar</code> file. </p>
  
  <pre><code>Error: Could not find or load main class com.jam.Jam
  Caused by: java.lang.ClassNotFoundException: com.jam.Jam
  </code></pre>
  
  <p>I have built the <code>.jar</code> file and setting the main class as <code>com.jam.Jam</code> and the class path for the <code>.jar</code> file as <code>/home/username/Jam-Programming_Language/src/com/jam/Scanner.Scanner</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/xIOUw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xIOUw.png" alt="Directory&#39;s layout"></a></p>
  
  <p>This is the layout of my project directory.</p>
  
  <p>The following solutions I have tried: </p>
  
  <p><a href="https://stackoverflow.com/a/36436695/11002705">Solution 1</a></p>
  
  <ol>
  <li>Open Project Structure</li>
  <li>Select Modules, then click on the module for which you want the
  dependency</li>
  <li>Choose the Dependencies tab</li>
  <li>Click the '+' at the bottom of the page and choose the appropriate
  way to connect to the library file. If the jar file is already
  listed in Libraries, then select 'Library'.</li>
  </ol>
  
  <p>and </p>
  
  <p><a href="https://stackoverflow.com/a/9705216/11002705">Solution 2</a></p>
  
  <ol>
  <li>Go to the Project Structure, click on Modules, and click on your
  Module</li>
  <li>Choose the "Dependencies" tab</li>
  <li>Click the "+" button on the right-hand side and select "Jars or
  directories..."</li>
  <li>Add the directory(ies) you want (note you can multi-select) and
  click OK
      In the dialog that comes up, select "classes" and NOT "jar directory"
      Make sure you're using that Module in your run target</li>
  </ol>
  
  <p>It had no effect apparently. Any clue on what I should do?    </p>
  
  <p>Edit: Uploaded wrong screenshot, replaced screenshot. </p>