Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The things that seem to be needed in NetBeans are:</p> <ul> <li>The project has to be the Main Project (by right clicking on it in the Projects list).</li> <li>You have to set the Main Class in the project properties. (Right click, Properties, Run, Main Class.)</li> </ul> <p>Then when you right click on your project and do a "Clean and Build", a jar will get built into the <code>dist</code> subdirectory.</p> <p>If that fails to fix the problem, here's a longer story...</p> <p>When you double click a jar file to run it, the operating system acts as if you had typed this from the command line:</p> <pre><code>java -jar filename.jar </code></pre> <p>(When you say it works for you from the command line, is this what you're typing?)</p> <p>At that point, the Java executable looks for a file inside the jar named <code>META-INF/MANIFEST.MF</code>. And then in the contents of that file, it looks for the value of a property, <code>Main-Class</code>. And finally it looks for the class of that name in your jar and runs its static <code>main(String[])</code> method.</p> <p>So if your jar is failing to run, you can do the following to debug what's going on:</p> <ul> <li>Clean and rebuild your project in NetBeans.</li> <li>Double check that your class(es) are actually in the jar: <ul> <li>Start a command prompt</li> <li><code>cd</code> into the <code>dist</code> subdirectory of your project.</li> <li>Use a command like <code>jar tf filename.jar</code> to list what's in there.</li> </ul></li> <li>Double check that the <code>MANIFEST.MF</code> file is correct: <ul> <li>Again in a command prompt</li> <li><code>cd</code> into the <code>dist</code> directory.</li> <li>Use a command like <code>jar xf filename.jar META-INF/MANIFEST.MF</code> to extract the manifest.</li> <li>Look at the contents of that file (e.g. <code>type META-INF\MANIFEST.MF</code>) and make sure <code>Main-Class</code> is set to the appropriate class.</li> </ul></li> </ul> <p>If all of the above check out, then double clicking the file <em>should</em> work.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload