<?xml version="1.0" encoding="UTF-8"?>
<section id="problems">
    <title>Problems</title>
    <!-- jEdit buffer-local properties:                      -->
    <!-- :indentSize=2:noTabs=false:maxLineLen=90:tabSize=2: -->
    <!-- :xml.root=faq.xml:                                  -->
    <!-- jEdit FAQ                                           -->
    <para>This section deals with problems you may experience while using or
    installing jEdit. Problems that aren't OS specific are listed under <link
    linkend="general-problems"><quote>General Problems</quote></link>.</para>
    <qandaset defaultlabel="qanda">
        <qandadiv id="general-problems">
            <title>General Problems</title>
            <qandaentry>
                <question id="wont-start">
                    <para>jEdit won't start. What should I do?</para>
                </question>
                <answer>
                    <para>If you don't have a clue as to why you cannot run
                    jEdit, it's best to perform a step-by-step diagnosis. If it
                    never worked before, begin by finding the Java application
                    loader you are using: <filename>java.exe</filename>,
                    <filename>javaw.exe</filename> or <filename>java</filename>.
                    Make sure it is running by entering its full path with the
                    <userinput>-h</userinput> parameter in a terminal or console
                    window. If you can't find the Java application loader, your
                    Java runtime environment package may be missing or
                    incomplete.</para>
                    <para>Next, find where you have installed jEdit. You should
                    look for the file <filename>jedit.jar</filename> which
                    contains all of the application's Java class files in a
                    compressed archive.</para>
                    <para>Once you have both files, run the Java loader with the
                    <userinput>-jar</userinput> option and with
                    <filename>jedit.jar</filename> as the target. Make sure that
                    you either specify full paths for both files or that the
                    directories for the files are part of your
                    <filename>PATH</filename> environment variable. If jEdit
                    does not load at this point, the likely problem is a corrupt
                    <filename>jedit.jar</filename> file. Try downloading the
                    application again.</para>
                    <para>If jEdit does load using this procedure, you need to
                    examine the <quote>shortcut</quote> loading mechanism you
                    wish to use.</para>
                    <para>On Linux and MacOS X, you need to find and examine the
                    <filename>jedit</filename> shell script provided by the
                    installation routine to confirm that the script's commands
                    target the correct files and locations, and that variables
                    like <filename>JAVA_HOME</filename> are either defined in
                    the script or elsewhere in your shell's environment. Don't
                    forget to make sure that the script's file permissions allow
                    you to execute it as a shell script.</para>
                    <para>On Windows, if you are using a batch script to run
                    jEdit, the same points (other than file permissions) apply
                    to examining <filename>jedit.bat</filename>. If you are
                    using jEditLauncher, run <userinput>jedit /p</userinput> in
                    jEdit's installation directory from a command line to get
                    the custom loader's setup dialog. Here you can check the
                    paths for both the Java application loader and jEdit as well
                    as any command line parameters for both programs. Make sure
                    that you have placed Java and jEdit options in the correct
                    input fields. If the parameters seems correct but jEdit will
                    not load with the Windows launcher, try uninstalling and
                    reinstalling the launcher by running <userinput>jedit
                    /u</userinput> followed by <userinput>jedit
                    /i</userinput>.</para>
                    <bridgehead>But it worked before! It just stopped working
                    after an upgrade. What should I do?</bridgehead>
                    <para>If it used to work for an older version and no longer
                    works, it could be that you have some old crud (bad
                    settings, unsupported plugins) in your jEdit
                    settings directory (<literal>~/.jedit</literal> on Linux,
                    <literal>%APPDATA%\jEdit</literal> on Windows, or
                    <literal>~/Library/jEdit</literal> on MacOS).
                    You may want to try renaming the offending directory
                    to something else, and restarting jEdit with fresh settings.
                    You can later copy things from your old settings back
                    if you find you are missing things. </para>
                    <para>If at this point you're still stuck, ask for help on
                    the jedit-users mailing list, the jEdit Community
                    <quote>Installation</quote> message board or on IRC. You're
                    bound to find someone quickly.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="start-missing-plugins">
                    <para>After jEdit starts, I can't see all of the plugins I
                    have downloaded. How can I make them appear?</para>
                </question>
                <answer>
                    <para>If you use jEdit's Plugin Manager to download and
                    install plugins, your plugins will be found in the
                    <filename>jars</filename> subdirectory of one of two
                    directories: either the directory in which jEdit is
                    installed, or the current user's settings directory. These
                    are the only location jEdit examines when it loads plugins
                    at startup.</para>
                    <para>The default location of the settings directory depends
                    on your operating system. You can find out its location
                    during a jEdit session by evaluating
                    <userinput>jedit.getSettingsDirectory()</userinput> in
                    BeanShell.</para>
                    <para>The settings directory can be changed by using the
                    <userinput>-settings</userinput> command line parameter. If
                    you change the location of the settings directory with this
                    parameter, jEdit will not be able to find plugin archive
                    files in the old location. If you use or change the
                    <userinput>-settings</userinput> parameter, make sure your
                    plugins don't get left behind.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="problems-out-of-memory">
                    <para>During an editing session I get an error message about
                    an <quote>OutOfMemoryError</quote> while working with a
                    large file or performing a lengthy operation. The message
                    reappears every time I retry the operation. How can I
                    prevent this?</para>
                </question>
                <answer>
                	<para>The memory requirements of jEdit vary greatly
                	depending on how many files are in use, and what plugins
                	you are using. You can see how much it is using in the
                	status bar. </para>
                    <para>One solution that often works is to set or increase
                    the allocation of memory to the heap for Java objects
                    created by the Java Virtual Machine in which jEdit is
                    running. Add a command line option
                    <userinput>-mx640m</userinput> to the options passed to the
                    version of the Java application loader you are using (such
                    as <filename>java</filename>, <filename>java.exe</filename>
                    or <filename>javaw.exe</filename>). In place of the
                    <userinput>640</userinput> in the option, use a number
                    of megabytes you think is appropriate for the maximum heap
                    size. If you already are using the option, try doubling it.
                    </para>

                    <para> For more information about JVM options, see the <ulink url="../users-guide/jvm-options.html">page on JVM options</ulink> in the users guide. </para>

                    <para> On Windows, if you are using the <literal>jedit.exe</literal> launcher, you can add
                    or change the JVM arguments by editing a file called <literal>jEdit.l4j.ini</literal> in the same directory
                    as the <literal>jedit.exe</literal>. Place one
                    JVM argument (e.g. <literal>-mx640m</literal>) on each
                    line by itself. </para>

                    <para>If out of memory errors occur while running a build or
                    compilation operation from within jEdit, you can also have
                    the operation run in an external process rather than inside
                    the same Java Virtual Machine running jEdit. The AntFarm
                    plugin, for example, lets you select this approach as a
                    configuration option. In other cases, you can run an
                    external program using the command line interface of the
                    Console plugin, which will capture and display the output of
                    the external process and in many cases parse the output for
                    error information.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="textarea-corruption">
                    <para>My textarea gets confused about the end of the buffer or in some other way corrupted (the characters are in the wrong place on the screen, or I get an exception when I scroll to the bottom). What should I do?</para>
                </question>
                <answer>
                    <para>Before jEdit 5.0, it happened to me quite a bit too.
                    I use this macro to help avoid the need to restart jEdit.
<programlisting>
/** Reset_TextArea.bsh */
view.splitVertically();
view.unsplitCurrent();
</programlisting>
					Run this, and jEdit creates
                    a new TextArea for you, one that is in a valid state. </para>

                    <para>If you can reproduce the steps you took to cause this,
                    please submit a bug report that details what
                    plugins/versions you were using, and how to reproduce it. It
                    may be specific to a file you are editing, or a particular
                    combination of settings you are using, or sequence of
                    actions you performed. </para>
                    </answer>
            </qandaentry>
            <qandaentry>
                <question id="general-borders">
                    <para>Why is jEdit's window movement and resizing so
                    buggy?</para>
                </question>
                <answer>
                    <para>Perhaps the option to let Java draw window borders is
                    enabled. This option can lead to strange behavior on some
                    Java versions and operating systems. Disable it in the
                    <guilabel>Appearance</guilabel> tab of the
                    <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
                    Options</guimenuitem> dialog box.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="install-no-such-file">
                    <para>What should I do when the installer displays the
                    message, <screen>No such file or directory</screen>?</para>
                </question>
                <answer>
                    <para>The full message that you may receive from the Java
                    application launcher begins as follows: <screen>Exception in thread "main" java.util.zip.ZipException: No such file or directory
...</screen> This means that the Java application launcher cannot read the jar
                    archive file that you specified on the command line. If your
                    Java runtime environment otherwise runs properly, then
                    either you have named the incorrect file name or the
                    installation file is corrupt or incomplete. Check the file
                    name, download the installer again if necessary, and be sure
                    to follow any specific instructions for your operating
                    system posted on the <ulink url="http://www.jedit.org">jEdit
                    web site</ulink>.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="install-noclassdef">
                    <para>After downloading
                    <filename>jeditXXXinstall.jar</filename> (the
                    <filename>XXX</filename> represents the version number), I
                    tried to run <userinput>java
                    jeditXXXinstall.jar</userinput>, but got the error message,
                    <screen>Exception in main(), NoClassDefFoundError: jeditXXXinstall/jar.</screen>
                    What am I doing wrong?</para>
                </question>
                <answer>
                    <para>You need to specify the <userinput>-jar</userinput>
                    option for the Java application loader so that the loader
                    will search the installation archive for the starting class
                    file. Without the option, it treats the archive as a single
                    class file (which it is not!), thus producing the error. The
                    correct command line would be <userinput>java -jar
                    jeditXXXinstall.jar</userinput>.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="jedit-crashed">
                    <para>jEdit crashed the JVM, what gives?</para>
                </question>
                <answer>
                    <para>It's important to realise that java applications
                    should never do this. The problem is almost certainly a bug
                    in the JVM. Problems of this nature are often tricky to
                    solve. Depending on your platform, there should be
                    information logged about what caused the crash to occur. For
                    Unix type systems you will likely get an error in the
                    console (and for Mac OS X you may also get a report in
                    ~/Library/Logs/CrashReporter/JavaApplicationStub.crash.log).
					</para>
                </answer>
            </qandaentry>

			<qandaentry>
                <question id="locks-up-or-hangs">
                    <para>jEdit locks up or hangs while I'm doing lots of things!  </para>
                    </question>
                    <answer>
                      <para> Sometimes, it can be due to a deadlock, or an
                      infinite loop, or something else. You need to obtain a
                      <emphasis role="bold">thread dump</emphasis> from the time
                      of hang, and attach that as a textfile to your bug report,
                      explaining what you were doing at the time.
                      </para>

                      <para> One way to obtain a thread dump, is to run jEdit
                      with <literal>java -jar jedit.jar</literal> from a command
                      line shell <emphasis role="bold">in the foreground</emphasis>,
                      wait for the hang or lockup, and type Ctrl+\
                      (or Ctrl+Break on Windows) into the shell window.
                      You should see a thread dump printed immediately that will
                      help diagnose the problem.
                      </para>

                      <para>
                      Another way to get a thread dump is to run jEdit as you
                      normally would, then run
                      <ulink url="http://visualvm.java.net/">visualvm</ulink>.
                      You can right click on the jEdit process from within
                      visualvm and choose "thread dump".
                      </para>

                    </answer>
			</qandaentry>
			<qandaentry>
                <question id="too-many-shortcuts">
                    <para>I can't remember all these multiple-key shortcuts! </para>
                    </question>
                    <answer>
                      <para> Install ShortcutDisplay plugin for help. </para>
                    </answer>
			</qandaentry>
            <qandaentry>
                <question id="general-slowstart">
                    <para>Why is jEdit so slow to start up?</para>
                </question>
                <answer>
                    <para>Some plugins require a lot of setup - chances are if
                    you disable one, you will be able to determine the culprit.
                    jEdit normally starts up quite quickly without
                    plugins.</para>
                    <procedure>
                        <step>
                            <para>To go the <guimenu>Utilities</guimenu> menu and
                            select <guimenuitem>Activity
                            Log</guimenuitem>.</para>
                        </step>
                        <step>
                            <para>Scroll to the area where you see lines like
                            <quote>[notice] JARClassLoader: Starting plugin
                            XXX</quote>.</para>
                        </step>
                    </procedure>
                    <para>You should be able to see which (if any) plugins are
                    causing an excesively long delay.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="general-slow">
                    <para>Why is jEdit so slow?</para>
                </question>
                <answer>
                    <para>There may be many causes for this. Java by nature is
                    more demanding on hardware than native applications. Modern
                    computers should not have much problem with this.</para>
                    <para>The most likely cause is plugins that parse buffers or
                    do other computationally expensive operations. These include
                    XML, JavaSideKick, and CodeAid. If performance is important
                    to you, installing a whole batch of plugins in one go is
                    probably not a very good idea. Install them one at a time,
                    so you can evaluate the effects of each. </para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="general-docking">
                    <para>Go to left/top/bottom/right docking area does not work
                    for some plugins?</para>
                </question>
                <answer>
                    <para>The plugin is missing a
                    <methodname>requestDefaultFocus()</methodname> method.
                    Check the jedit plugin bugs tracker to see if the ticket
                    is already opened and you can open a ticket if it's not there. </para>
                </answer>
            </qandaentry>
        </qandadiv>
        <qandadiv id="unix-problems">
            <title>Unix/Linux Problems</title>
            <qandaentry>
			    <question id="using-older-jre">
				  <para>I'm trying to install jEdit on Linux, but I keep getting strange error messages.
				  </para>
<programlisting>
Exception in thread "main" java.lang.UnsupportedClassVersionError:
installer/Install (Unsupported major.minor version 49.0)
Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit
</programlisting>
				</question>
				<answer>
				 <para> Make sure the version of Java you are running is Oracle Java 1.8 or higher.
				 In debian/ubuntu,
				 <literal> apt-get install openjdk-8-jdk </literal>
				 </para>
		        </answer>
				</qandaentry>
		     <qandaentry>
                <question id="install-jedit-home">
                    <para>After installing jEdit on Linux, running the
                    <userinput>jedit</userinput> command causes the error
                    message: <screen>Warning: JAVA_HOME environment variable not set</screen>
                    How can I fix this?</para>
                </question>
                <answer>
                    <para>Your <filename>jedit</filename> shell script should be
                    modified to set the <userinput>JAVA_HOME</userinput>
                    variable to the directory containing the executables of your
                    desired Java runtime environment (JRE).</para>
                </answer>
            </qandaentry>
        </qandadiv>
        <!--******************************************************** Windows -->
        <qandadiv id="windows-problems">
            <title>Windows Problems</title>
            <qandaentry>
                <question id="install-windows-errmessage">
                    <para>When I try to run <filename>jedit.exe</filename> I get
                    the message <screen>The JEditLauncher component does not appear to be installed.</screen></para>
                </question>
                <answer>
                    <para>The dialog presenting this message asks if you would
                    like to install the launcher. Select
                    <userinput>Yes</userinput> and supply further information as
                    prompted. A file named <filename>install.log</filename> is
                    generated in the same directory as
                    <filename>jedit.exe</filename> that contains information on
                    the launcher's installation. You can send this file along
                    with jEdit's Activity Log if you continue to have problems
                    running jEdit with the launcher package.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="install-error-regkey">
                    <para>When I try to run the jEdit installation package in
                    Windows, I get an error message, <screen>Error opening registration key
				"software\javasoft\java runtime	environment".</screen> How can I fix
                    this?</para>
                </question>
                <answer>
                    <para>The problem is not with jEdit but may be caused by
                    your installation of the Java runtime environment. Under
                    Windows, Sun's Java application loader relies on entries in
                    the Windows registry to find the files that create the
                    runtime environment and a Java virtual machine. The loader
                    (<filename>java.exe</filename>e or
                    <filename>javaw.exe</filename>) is unable to find the
                    necessary registration entry and therefore sends the error
                    message. The best approach to fixing this is to uninstall
                    and reinstall the JDK.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="install-windows-badcommand">
                    <para>When trying to install jEdit on Windows Me with an
                    MS-DOS prompt, after entering <userinput>java -jar
                    jeditXXXinstall.jar</userinput> I get the message
                    <userinput>bad command or file name</userinput>. I have
                    tried various alternatives but still cannot install.</para>
                </question>
                <answer>
                    <para>You should confirm that you have a Java runtime
                    environment installed, which will include
                    <filename>java.exe</filename> and the version that omits a
                    separate terminal window, <filename>javaw.exe</filename>.
                    Make sure that the directory containing
                    <filename>java.exe</filename> or
                    <filename>javaw.exe</filename>is found in the value of your
                    <filename>PATH</filename> environment variable. Otherwise
                    you should give the full path to the chosen loader on your
                    command line.</para>
                </answer>
            </qandaentry>
            <qandaentry>
                <question id="general-windows-ddraw">
                    <para>When I run jEdit on Windows, it flashes, blinks, and
                    doesn't display correctly! Why is your program so
                    buggy?</para>
                </question>
                <answer>
                    <para>A frequent cause of this problem is buggy video
                    drivers and/or a buggy DirectDraw implementation. A
                    workaround is to disable Java's use of DirectDraw by adding
                    the following option to the Java virtual machine command
                    line:</para>
                    <programlisting>-Dsun.java2d.noddraw=true</programlisting>
                </answer>
            </qandaentry>
        </qandadiv>
    </qandaset>
</section>
