meta
<html>
<head>
    <title>BlueJ Tutorial: Part 7</title>
    <link rel="stylesheet" type="text/css" href="htmlsrc/tutorial.css">
</head>
<body>
<div class="part-links">
    <a href="part6.html" class="part-prev">Part 6</a>
    <a href="tutorial.html" class="part-toc">BlueJ Tutorial: Part 7</a>
    <a href="part8.html" class="part-next">Part 8</a>
</div>

<h2>The main Method and Running Outside BlueJ</h2>

<p>Complete Java programs usually have a method called "main".  So far in this tutorial, a main method has not been necessary: BlueJ intentionally lets you create objects and invoke methods interactively without needing a main method.  If you add one, BlueJ can invoke that too, but it does not treat it specially; it is just like any other invocable method.</p>

<h3>Running outside BlueJ</h3>

<p>The time when you will need a main method is if you want to run your program outside BlueJ.  BlueJ lets you export your application to a stand-alone JAR file which can be run on any computer which has Java, without needing BlueJ.  This is available from the Project menu, by using the <span class="menu">Create JAR file...</span> menu item.  This will ask you to select a main class.  You will either need to select a JavaFX Application sub-class, or select a class with a <tt>public static void main(String[] args)</tt> method.</p>

<div class="part-end">
<a class="part-next" href="part8.html">Part 8</a>
</div>
</body>
</html>





33 HTM Commands =
green / bluej / lib / tutorial / part7.html