title: "java.lang.ClassNotFoundException: com.google.gson.Gson" but have it in build path on local project on Eclipse
body: <p>I'm attempting my first Java project and would like to use Gson to read in a Json file (which I generated from a spreadsheet) to then be added as class objects.</p>
  <pre><code>import com.google.gson.Gson;
  
  public class Init {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          
          Gson gson = new Gson();
          
          FileReader fr = null;
          try {
              fr = new FileReader(&quot;Log_Model.json&quot;);
          } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          
           Object json = gson.fromJson(fr, Item[].class);
           //https://futurestud.io/tutorials/gson-mapping-of-arrays-and-lists-of-objects
           System.out.println(json);
          }
  </code></pre>
  <p>When I run this I get the following error,</p>
  <pre><code>    Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: com/google/gson/Gson
      at relog.Init.main(Init.java:13)
  Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      ... 1 more
  </code></pre>
  <p>I'm using Eclipse which is installed in my User folder on Windows 7, the gson jar is placed in the project folder and I've added it to the build path.
  <a href="https://i.stack.imgur.com/oCUbu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oCUbu.png" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/oMZix.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oMZix.png" alt="enter image description here" /></a></p>