I have been able to debug a small Java application remotely, at the MS-DOS
prompt. I'd like to be able to do the same thing, using Emacs and JDE, 
but I have not been able to figure out which JDE variables to set.

My environment:

- jdk 1.3
- Emacs 20.7.1
- JDE 2.2.5.2
- semantic-1.2.1
- speedbar-0.12
- elib-1.0
- NT 4.0 Service Pack 6A

*** Here is the command I use to launch the Java VM on the remote system
(all parameters appear on the same line):

c:\jdk1.3\bin\java.exe -Xdebug  -Xnoagent
-Xrunjdwp:transport=dt_socket,address=8453,server=y,suspend=y -classpath .
Alphabet.Start.Start

*** Here is the contents of my ".emacs" file:

(setq system-name "RV-PLOSKIKL")

;; display line numbers in the current buffer
;; invoke by entering M-x setnu-mode
(load "h:/gnu/setnu/setnu.elc")

;; This package is a minor mode to visualize blanks (SPACE and TAB).
;;
(require 'blank-mode)

;; Insert spaces instead of a tab character for all files and modes
(setq-default indent-tabs-mode nil)
;; Make braces line up and set tab width to 4 (default is 2?)
;; styles (see c-mode-style.el): GNU Whitesmith K&R BSD C++
;; The following positions the opening left-curly brace
;; immediately below the letter i in "if" and indents 4 spaces
(add-hook 'c-mode-common-hook
          (function
           (lambda ()
             (c-set-style "BSD")
             (c-set-offset 'inline-open ' 0)
             (c-set-offset 'block-open ' -)
             (c-set-offset 'innamespace ' -)
             (setq tab-width 4))))

;; (add-untranslated-filesystem "N:")

;; To use the common open file dialogue:
;; Download dlgopen from Emacs FAQ
(setq dlgopen-executable-path "h:/gnu/dlgopen/dlgopen/getfile.exe")
(load "h:/gnu/dlgopen/dlgopen/dlgopen.el")

;; For CUA-mode.  Allows you to use standard Windows keybindings for
;; Copy (Ctrl-c), Paste (Ctrl-v), Delete (Ctrl-x) and Undo (Ctrl-z).  
;; You must highlight the region first.  Place "CUA-mode.el" in the 
;; Emacs lisp subdirectory.
;; (pc-selection-mode) by itself allows you to position the cursor
;; but not cut or paste with the mouse.
;; However, using (load "cua-mode") and (CUA-mode t) disables highlighting
when you do:
;; Ctrl-a Ctrl-Shift-2 (Mark Set) Ctrl-e
(pc-selection-mode)
;;(load "cua-mode")
;;(CUA-mode t)

;; Set the debug option to enable a backtrace when a
;; problem occurs.
(setq debug-on-error t)

(add-to-list 'load-path (expand-file-name "h:/gnu/jde-2.2.5/lisp"))
(add-to-list 'load-path (expand-file-name "h:/gnu/semantic-1.2.1"))
(add-to-list 'load-path (expand-file-name "h:/gnu/speedbar-0.12"))
(add-to-list 'load-path (expand-file-name "h:/gnu/elib-1.0"))

;; If you want Emacs to defer loading the JDE until you open a 
;; Java file, edit the following line
(setq defer-loading-jde nil)
;; to read:
;;
;;  (setq defer-loading-jde t)
;;

(if defer-loading-jde
    (progn
      (autoload 'jde-mode "jde" "JDE mode." t)
      (setq auto-mode-alist
            (append
             '(("\\.java\\'" . jde-mode))
             auto-mode-alist)))
  (require 'jde))


;; Sets the basic indentation for Java source files
;; to two spaces.
(defun my-jde-mode-hook ()
  (setq c-basic-offset 2))

(add-hook 'jde-mode-hook 'my-jde-mode-hook)


;; keyword syntax highlighting
(setq font-lock-maximum-decoration 
        '((java-mode . 2)))
(global-font-lock-mode t)

;; To activate the menu bar using the Alt key
(setq w32-pass-alt-to-system t)

;; Lets use of a Bar, rather than a block, for the cursor
;; can substitute box for bar in the following.
(cond (window-system
        (progn
        (setq default-frame-alist
                (append default-frame-alist
                        '((cursor-type . bar)
                        )))
        (setq initial-frame-alist
                '( (cursor-type . bar)
        )))))

;; Colors
(setq default-frame-alist 
        '((background-color . "lemon chiffon")
         (cursor-color . "red3")))

(set-default-font "-*- Courier New-bold-r-*-*-14-80-*-*-c-*-*-ansi-")

;; Emacs window is 40 columns wide and 80 rows high
(set-frame-height (selected-frame) 40)
(set-frame-width (selected-frame)  80)


;; to match left and right parenthesis
(show-paren-mode)

;; to use "Print" from the Emacs Tools menu
(setq printer-name "//RV-PRINT/Armadillo")

;; To use Internet Explorer to view JDK and JDE documentation
;; Download shelex.exe from Emacs FAQ
(defvar shell-execute-helper "shelex.exe")
(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))

(setq browse-url-browser-function 'shell-execute-url)
(setq gnus-button-url 'shell-execute-url)       ; GNUS
(setq vm-url-browser 'shell-execute-url)        ; VM


(custom-set-variables
 '(jde-bug-jre-home "h:\\jdk1.3")
 '(jde-compile-option-debug (quote ("all" (t nil nil))))
 '(jde-bug-server-socket (quote (t . "8453")))
 '(jde-db-option-classpath (quote (".")))
 '(jde-bug-jdk-directory "h:/jdk1.3/")
 '(jde-db-source-directories (quote ("c:/JavaPkg/" "c:/JavaPkg/Alphabet/"
"h:/jdk1.3/")))
 '(jde-bug-vm-executable (quote ("java")))
 '(jde-compiler "h:\\jdk1.3\\bin\\javac")
 '(jde-run-working-directory "c:\\javapkg\\")
 '(jde-bug-vm-includes-jpda-p t)
 '(jde-run-classic-mode-vm t))
(custom-set-faces)


*** Here is the output that appears in an Emacs buffer.  The VM is launched,
but my app is executed locally !!!

cd c:\javapkg\
jdb -classic -classpath . Alphabet.Start.Start

Initializing jdb...
> Deferring breakpoint Alphabet.Start.Start.main.
It will be set after the class is loaded.
> run Alphabet.Start.Start
Java HotSpot(TM) Client VM warning: Setting of property "java.compiler" is
ignored
> 
VM Started: Set deferred breakpoint Alphabet.Start.Start.main

Breakpoint hit: thread="main", Alphabet.Start.Start.main(), line=12, bci=0
  12        char [] chrLetters = {'a', 'B', 'a', 'B', 'a', 'B', 'a', 'B',
'a', 'B', 'a', 'B', '\0'} ;

main[1] stop at Alphabet.Start.Start:15
Set breakpoint Alphabet.Start.Start:15
main[1] cont
> 
Breakpoint hit: thread="main", Alphabet.Start.Start.main(), line=15, bci=86
  15            i = 0 ;

main[1] cont
> 
Letter> A
Letter> B
Class B
Letter> A
Letter> B
Class B
Letter> A
Letter> B
Class B
Letter> A
Letter> B
Class B
Letter> A
Letter> B
Class B
Letter> A
Letter> B
Class B
Letter> 

The application exited

Debugger finished

Obviously, I'm missing some fundamental point (or two or more) about which
JDE variables to set.  

When I execute jdb at the MS-DOS prompt, I call jdb this way:

jdb -connect com.sun.jdi.SocketAttach:hostname=xxx.xx.xxx.xx,port=8453

Can you give me some guidance?  My *guess* is I need to set one or more JDE
variables that correspond to -connect and the
parameters supplied with it ...

I've searched the JDE mailing list archive, and the 2.2.5.2 Release notes,
and the JDE troubleshooting guide and JDE user guide, 
but I'm still at a loss.

THANK YOU!

Karen Ploski
[mailto:[EMAIL PROTECTED]]

Reply via email to