title: Why I obtain this "Unable to access jarfile" error when I try to execute my jar?
body: <p>I have the following problem trying to execute a jar file (created from my project) into the Windows shell (the DOS prompt).</p>
  
  <p>I have a file named <strong>Main.jar</strong>. If I unzip this file it contains a <strong>mainPkg</strong> folder (that is the name of the package containing the <strong>Main</strong> class that itself contains the <strong>main()</strong> method).</p>
  
  <p>So into the <strong>mainPkg</strong> folder there is the <strong>Main.class</strong> file that contains the <strong>main()</strong> method.</p>
  
  <p>Ok so, from the shell, I go into the directory that contains the <strong>Main.jar</strong> and I perform:</p>
  
  <pre><code>C:\Projects\edi-sta\build\jar&gt;java -jar mainPkg.Main.jar
  Error: Unable to access jarfile mainPkg.Main.jar
  </code></pre>
  
  <p>But as you can see I obtain the <strong>Unable to access jarfile mainPkg.Main.jar</strong>. Why? What am I missing? How can I solve this issue and execute my <strong>Main.jar</strong> file?</p>