JDE Troubleshooting Guide

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

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.

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))
          ad-do-it)))
      
    

    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 
    d/applications/ie4/iexplore 
    [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
    browse-url-generic
    

    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 am using NT/Emacs 20.3.1 and JDE 2.1.0 and the version of speedbar that comes with JDE 2.1.0.  On Emacs startup, I get the error

Error in init file: Symbol's function definition is void:
speedbar-make-specialized-keymap

There is some incompatibility between 20.3.1 and the (out-of-date) version of speedbar included in
JDE 2.1.0. The next versions of NT/Emacs and of the JDE will include a compatible version. In the meantime:

Solution: Either download the latest version, 0.7.2b, of speedbar or use the version that comes with 20.3.1 after correcting the typo that occurs in that version (see next problem).

Problem: I am using NT/Emacs 20.3.1 and JDE 2.1.0 and the version of speedbar that comes with 20.3.1.  On Emacs startup, I get the error

Signaling: (void-variable c-frame)

The version of speedbar that comes with NT/Emacs 20.3.1 has a typo that results in a reference to the undefined symbol c-frame. You cannot use the version that comes with JDE 2.1.0 (see previous problem). The next versions of NT/Emacs and of the JDE will include a compatible version. In the meantime:

Solution: Download the latest version of speedbar from

ftp://www.ultranet.com/pub/zappo/speedbar-0.7.2b.tar.gz

or change the line that reads

(define-key speedbar-key-map "Q" 'delete c-frame)

in the 20.3.1 version of speedbar to

(define-key speedbar-key-map "Q" 'delete-frame)

and recompile speedbar.el.

Problem: On Emacs startup, Emacs signals some error.

This is by far the most common JDE problem reported. It almost alway occurs for one or more of the following reasons:

Solution: Make sure that you have installed and compiled all the packages required by the JDE and that you have put the packages at the head of your load-path.

Problem: On Emacs startup, this message appears:

Error in init file: error: "Lisp nesting exceeds max-lisp-eval-depth"

Solution: Download the latest version of cc-mode (5.20 or greater) and compile all the .el files in the cc-mode distribution. When compiling the cc-mode files, please be sure to follow exactly the compilation instructions given in the readme file that accompanies the cc-mode distribution.

Problem: I installed the latest version of cc-mode and now I cannot indent a line by pressing the TAB key. In fact, when I edit a .c or .java file and hit tab, I get:

"Invalid function: (macro . #[(cond &rest body) "\300    \302^KBE\207"
[if cond progn body] 4 ("c:/mcarland/lisp/cc-mode-5.20/cc-mode-19.elc" . 1007)])"

Martin Stjernholm <mast@lysator.liu.se> reports that CC Mode 5.20 doesn't byte compile correctly under Emacs 19.34, because the compatibility macros in cc-mode-19.el aren't required prior to compilation. The patch below fixes this. There will be a bugfix release out soon too.

--- cc-make.el  1997/10/03 15:13:31     5.12
+++ cc-make.el  1998/02/10 22:48:57     5.13
@@ -20,7 +20,15 @@
           (error nil))
         ;; Stock Emacs 19.34 doesn't have this
         (fboundp 'defcustom))
-    (batch-byte-compile)
+    (progn
+      (if (or (not (fboundp 'functionp))
+             (not (fboundp 'char-before))
+             (not (c-safe (char-after) t))
+             (not (fboundp 'when))
+             (not (fboundp 'unless)))
+         ;; cc-mode-19.el contains macros that should be compiled in.
+         (require 'cc-mode-19))
+      (batch-byte-compile))
   (error STOP! STOP! STOP! STOP!
 
The Custom library was not found or is out of date.  A more current

Solution: Martin suggests the easiest way to fix  this problem is to use the following command to byte-compile the cc-mode files:

emacs -batch -no-site-file -q -l cc-mode-19.el -l cc-make.el cc-*.el
                              ^^^^^^^^^^^^^^^^
                                    add this

Problem: On Emacs startup, I get the following message:

Error in initfile: Symbol's value as variable is void:
font-lock-defaults-alist

Solution: Put the following statements

(require 'font-lock)
(require 'jde)

in your .emacs file. The next release of the JDE will require font-lock to avoid this problem.

Problem: On startup of XEmacs 20.2, I get the following error message

Unknown keyword
speedbar-ignored-path-expressions

Solution: Use load-file instead of require to force loading of the 1.9961 version of custom, e.g., put the following in your .emacs file

;;(require 'custom)
(load-file (expand-file-name "~/custom-1.9961/custom.elc"))

Apparently the version of custom distributed with XEmacs 20.2 is broken in some way.

Problem: On startup or when compiling jde.el, NT/Emacs 19.34.6 signals:

Symbol's value as variable is void ((:set))

This indicates that an older version of custom is shadowing custom 1.9961 in your load-path.

Solution: Set your load-path so that the custom 1.9961 directory precedes the NT/Emacs Lisp distribution directory in your load-path.

Problem: On startup or when compiling jde.el, NT/Emacs 19.34.6 signals:

Symbol's value as variable is void ((:version))

The latest version of browse-url.el refers to a defcustom keywork :version that does not appear to be defined in the backward compatiblity verion of custom (custom-1.9961).

Solution: Comment out line 340 in browse-url.el (Thanks toJean-Dominique Sifantus <jsifantu@tiac.net> for this fix.

Problem: I cannot get w3 to display the JDE User's Guide (jde.htm) from the JDE 1.9.4 Help menu.

Solution: Install the following patch (thanks to Les Schaffer <godzilla@netmeg.net>)
on jde.el:

*** jde.el~     Fri Feb 27 18:19:09 1998
--- /usr/local/lib/xemacs/site-lisp/jde/jde.el  Sat Feb 28 15:58:11 1998
***************
*** 822,828 ****
          (if jde-dir
              (expand-file-name "doc/jde.htm" jde-dir))))
      (if jde-help
!       (browse-url jde-help  browse-url-new-window-p)
        (signal 'error '("Cannot find JDE help file.")))))
 
  ;; speedbar
--- 822,828 ----
          (if jde-dir
              (expand-file-name "doc/jde.htm" jde-dir))))
      (if jde-help
!       (browse-url (concat "file:" jde-help)  browse-url-new-window-p)
        (signal 'error '("Cannot find JDE help file.")))))
 
  ;; speedbar

 
Problem: On Windows 95, when I select Browse JDK Doc or Help, the browser opens and loads the
required document,  but the Emacs window stops responding until I exit the browser.

Solution:  Change the definition of shell-execute-url in your .emacs file to read as follows

(defun shell-execute-url (url &optional new-window)
  "Invoke the shell-execute-helper program to call ShellExecute and launch
     or re-direct a web browser on the specified url."
  (interactive "sURL: ")
;  (call-process shell-execute-helper nil nil nil url)
  (start-process "shellex" nil shell-execute-helper url))

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)
 

Note The 19.34.6 version of NT/Emacs has a bug that results in the name of the JDE mode hook variable being jde-mode-hooks. Thus, the NT/Emacs 19.34.6 equivalent of the previous example is

(defun my-jde-mode-hook ()
  (setq c-basic-offset 2))
(add-hook 'jde-mode-hooks '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: I am using the JDE with NT/Emacs 20.2.x. When I run a Java application with a GUI, the application starts but nothing appears.

NT/Emacs 20.2.x is a development version that introduces changes that break the JDE run command among other JDE features. The JDE eventually will be updated to support NT/Emacs 20.2, probably when a stable version appears, possibly sooner.

Solution: Use NT/Emacs 19.34.6 until the JDE is updated to support 20.2.