<chapter id="invocation">
  
<title>Invocation</title>

<indexterm>
<primary>invocation</primary>
<secondary>GoGui</secondary>
</indexterm>

<para>
<application>GoGui</application> can be invoked with the command:
<programlisting>
<userinput>java -jar gogui.jar [options] [file]</userinput></programlisting>  
The command line for executing the actual Go program can be given
with the <option>-program</option> option, otherwise GoGui will start with
the Go program attached in the previous run, or without Go program if there
was none attached.
You can attach and detach a Go program at any time by using the
<guimenuitem>Attach Program</guimenuitem> and
<guimenuitem>Detach Program</guimenuitem> menu item from the
<guimenu>File</guimenu> menu.
</para>

<para>
See <xref linkend="reference-gogui"/> for a complete listing of the possible
options to <userinput>gogui</userinput>.
</para>

<para>
<note>
<title><application>GoGui</application> on Unix</title>

<para>
<indexterm>
<primary>invocation</primary>
<secondary>Unix</secondary>
</indexterm>
For Unix systems, there are launcher scripts in the
<filename class="directory">bin</filename> directory.
<indexterm>
<primary><envar>GOGUI_JAVA_HOME</envar></primary>
</indexterm>
The launcher scripts respect the environment variable
<envar>GOGUI_JAVA_HOME</envar>, if defined, and look for the jar files
in <filename class="directory">../lib</filename>
relative to the <filename class="directory">bin</filename> directory.
You can add the <filename>bin</filename> directory of GoGui to your
<envar>PATH</envar> environment variable.
<indexterm>
<primary><envar>PATH</envar></primary>
</indexterm>
The invocation is then simply:
<programlisting>
<userinput>gogui [options] [file]</userinput></programlisting>
To register <application>GoGui</application> as a handler
for <ulink url="http://www.red-bean.com/sgf/"><acronym>SGF</acronym></ulink>
files, you can configure a new file association for type
<userinput>application/x-go-sgf</userinput> and filename pattern
<userinput>*.sgf</userinput> to execute
<userinput>gogui</userinput>.
<indexterm>
<primary>SGF</primary>
<secondary>register GoGui as a handler</secondary>
</indexterm>
</para>
</note>
</para>

</chapter>
