JDE Troubleshooting Guide

The following describes common problems using the JDE and their solutions.

Problem I can't get the JDE to use Internet Explorer to display the JDK doc or the JDE User's Guide.

Solution The JDE uses Emacs browse-url interface to web browsers. browse-url supports Netscape by default. To use Internet Explorer:

  1. Add the following code to your .emacs file
    (if (eq system-type 'windows-nt)
      (defadvice browse-url-generic (around show-window act)
        "*Sets `start-process-show-window' on."
        (let ((w32-start-process-show-window t))

    This code causes Emacs to show the window of the browser launched by the function browse-url-generic.

  2. Customize the variable browse-url-generic-program to specify iexplore as the "generic" browser on your system.

    (To display the custom buffer for browse-url, execute

    M-x customize-group browse-url)

    After you have done this, the custom buffer should look like

    Browse Url Generic Program [Hide] [Value Menu] String 
    [State] this option has been set and saved.
    The name of the browser program used by `browse-url-generic'.
  3. Customize the variable browse-url-browser-function to specify

    as the function that invokes the browser when the command browse-url is executed.

    After you have done this, the custom buffer should look like this:

    Browse Url Browser Function [Hide] [Value Menu] browse-url-generic
    Ask the WWW browser defined by `browse-url-generic-program' to load URL. [More]
    [State] this option has been set and saved.
    Function to display the current buffer in a WWW browser. [More]
  4. Restart Emacs.

Problem: I've just updated to Emacs 20.3.1 and the latest JDE.  I used to set my CLASSPATH in my .emacs as follows:

(setq jde-global-classpath '("c:/jdk1.1.7/lib/classes.zip" "."))

However, this no longer takes effect, and I seem forced to use customize.

Is this a deliberate change in policy?

Solution: Yes, you must use custom to customize JDE variables (or at least duplicate its behavior). The reason is that custom on most versions of Emacs does not allow customization of buffer-local variables. This conflicts with the need for the JDE to support project-specific customization of JDE variables. The JDE solves this problem by taking advantage of the fact that custom stores the standard and customized values of a variable as properties of the variable. Whenever you open or switch Java source buffers, the JDE resets the values of each JDE variable according to the following rules:

As you can see from the foregoing, the JDE resets the value of each JDE variable whenever you open or switch buffers to either a value stored in a prj.el file or to a value stored as a property of the variable. Thus, any value set by a setq statement in your .emacs file will be overwritten. So if you want to customize a variable in your .emacs file, you have two options:


Problem: I would like to change the default value of the cc-mode customization variable c-basic-offset for use with JDE - but alas, I've had no luck in doing so. No matter what I've attempted, editing a Java source file always ends up with the original value of 4 rather than the value of 2 that I've specified.

cc-mode's default "style" for editing Java code (which JDE inherits) resets c-basic-offset to 4 whenever you open a Java buffer.

Solution: The following, which you should put in your .emacs file, sets it back to 2.

(defun my-jde-mode-hook ()
  (setq c-basic-offset 2))
(add-hook 'jde-mode-hook 'my-jde-mode-hook)

Problem: I start the debugger but the Jdb menu does not appear on the Emacs menu bar as pictured in the user's guide.

Solution: Set an initial breakpoint in the jdb command buffer and run to that breakpoint. Then, select the Java source buffer in which the debug cursor appears. You should see the Jdb menu on the menubar. Note: that the Jdb menu appears only after an initial breakpoint has been reached and when a Java source buffer is selected. See the JDE User's Guide for more information.

Problem When I compile a file, the compilation command is including invalid flags.I am using the latest version of the JDE with JDK 1.1.x.

Solution The JDE's compile command (selected via JDE->Compile)   invokes the compiler with command-line arguments that select the compiler options you have chosen via the JDE->Options->Compile command. The command line switches accepted by the JDK 1.2 version of javac changed somewhat from those accepted earlier versions. By default, the JDE compile command   uses the command-line switches defined by the JDK 1.2 version. If you are using earlier versions of javac and you want to use a command-line switch that is no longer supported by JDK 1.2 or has changed, you have two options. In the case of the -depend switch, which changed to -Xdepend in Java 1.2, you can cause the JDE to revert to the earlier form by setting the jde-compile-option-depend-switch. In fact, you need to do this, if you want to use the JDE's Java build command (JDE->Build). For other switches that have changed, you can specify the earlier form via the jde-compile-option-command-line-arg option.