title: Why do I need to delete the package line to run Java outside of NetBeans?
body: <p>So I'm completely new to programming, and I've been writing some Java with the NetBeans IDE. My code runs fine within NetBeans, but I've tried to run it using the command line as well. However, if I run it from the command line, I have to delete the line:</p>
  
  <pre><code>package firstprogram;
  </code></pre>
  
  <p>which NetBeans automatically places at the top of each new file, or I get the error:</p>
  
  <pre><code>Error: Could not find or load main class FirstProgram
  </code></pre>
  
  <p>However, if I do delete the line, then the program no longer runs within NetBeans! It doesn't seem right that I have to choose whether to run a .java from within NetBeans or without.</p>
  
  <p>The research I've done makes me think that this is something to do with directory structure? But everything I read on that goes straight over my head. NetBeans has a structure with "build", "dist", "nbproject", and "src", but when I use the command line I just place the .java file in an empty directory and javac from there.</p>
  
  <p>Any explanation is appreciated! The books and tutorials I'm learning from either assume you're just using NetBeans or don't have the package line at all.</p>