I can compile and run a java program. The debugger appears to work, though there are
two things missing.
1. There is no "=>" pointing into the source file window when I step through the
program.
2. The jdb menu does not appear, even after following the instructions to insert a
breakpoint and to return to the source file.
Here is the program I am experimenting with:
/**
* The HelloWorldApp class implements an application that
* simply displays "Hello World!" to the standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
}
}
Listed below is the JDE/Emacs environment. Thanks for your help.
Sandor Szabo
NT 4.0, SP 4
JDE 2.1.5
EMACS 20.3.1
cc-mode 5.21
;;start .emacs
;; for some reason, the NT default is 3
(setq w32-num-mouse-buttons 2)
;; Set the icon and frame titles %f file name, %b buffer name
(setq frame-title-format "%b")
(setq icon-title-format "%f")
;;; Start off in "home" dir.
(cd "E:/")
;; This is all part of getting JDE (java development environment) running
;; see http://sunsite.auc.dk/jde/
; need browse-url.elc
(load-library "browse-url.elc")
; After JDE installed, set path
(setq load-path
(nconc
'(
"e:/Program Files/Emacs Add-Ons/jde-2.1.5"
;; Add paths to other add-on packages here.
)
load-path))
; load on startup
(require 'jde)
; get the rest from the example "minimal .emacs file"
;; 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)
;; Include the following only if you want to run
;; bash as your shell.
;; Setup Emacs to run bash as its primary shell.
(setq binary-process-input t)
(setq w32-quote-process-args ?\")
(setq shell-file-name "bash")
(setq explicit-shell-file-name shell-file-name)
(setenv "SHELL" shell-file-name)
(setq explicit-sh-args '("-login" "-i"))
(setq w32-quote-process-args ?\") ;; Use Cygnus quoting rules.
;; Configure Emacs to use the default browser on your system
;; to display the JDE documentation.
(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)
;; extra key bindings
(global-set-key "\C-c\C-n" 'narrow-to-region)
(global-set-key "\ej" 'fill-indented-paragraph)
(global-set-key "\C-c\C-j" 'set-fill-prefix)
(global-set-key "\C-x5" 'split-window-horizontally)
(global-set-key "\C-x\C-b" 'buffer-menu-other-window)
(custom-set-variables
'(jde-compile-option-command-line-args "-g")
'(jde-db-option-classpath nil)
'(jde-db-source-directories nil))
(custom-set-faces)
;; end .emacs
=============================== pr.el ==================================
(jde-set-project-name "default")
(jde-set-variables
'(jde-run-option-properties nil)
'(jde-run-option-stack-size (quote ((128 . "kilobytes") (400 . "kilobytes"))))
'(jde-gen-buffer-templates (quote (("Class" . jde-gen-class) ("Console" .
jde-gen-console) ("Swing App" . jde-gen-jfc-app))))
'(jde-compile-option-command-line-args "-g")
'(jde-gen-action-listener-template (quote ("'& (P \"Component name: \")"
"\".addActionListener(new ActionListener() {\" 'n>" "\"public void
actionPerformed(ActionEvent e) {\" 'n>" "\"}});\" 'n>")))
'(jde-compile-option-depend nil)
'(jde-compile-option-optimize nil)
'(jde-run-option-verify (quote (nil t)))
'(jde-gen-inner-class-template (quote ("'& \"class \" (P \"Class name: \" class)" "(P
\"Superclass: \" super t)" "(let ((parent (jde-gen-lookup-named 'super)))" "(if (not
(string= parent \"\"))" "(concat \" extends \" parent))) \" {\" 'n>" "\"public \" (s
class) \"() {\" 'n> \"}\" 'n> \"}\" 'n>")))
'(jde-run-read-vm-args nil)
'(jde-entering-java-buffer-hooks (quote (jde-reload-project-file)))
'(jde-run-applet-viewer "")
'(jde-compile-option-debug (quote ("selected" (t nil nil))))
'(jde-project-file-name "prj.el")
'(jde-run-option-verbose (quote (nil nil nil)))
'(jde-run-application-class "")
'(jde-db-option-vm-args nil)
'(jde-run-option-heap-size (quote ((1 . "megabytes") (16 . "megabytes"))))
'(jde-compile-option-target (quote ("1.1")))
'(jde-appletviewer-option-encoding "")
'(jde-db-read-vm-args nil)
'(jde-db-option-heap-profile (quote (nil "./java.hprof" 5 20 "Allocation objects")))
'(jde-db-mode-hook nil)
'(jde-run-option-garbage-collection (quote (t t)))
'(jde-compile-option-vm-args nil)
'(jde-run-applet-doc "")
'(jde-compile-option-depend-switch (quote ("-Xdepend")))
'(jde-db-option-java-profile (quote (nil . "./java.prof")))
'(jde-compile-option-sourcepath nil)
'(jde-gen-get-set-var-template (quote ("'n>" "(P \"Variable type: \" type) \" \"" "(P
\"Variable name: \" name) \";\" 'n> 'n>" "\"/**\" 'n>" "\"* Get the value of \" (s
name) \".\" 'n>" "\"* @return Value of \" (s name) \".\" 'n>" "\"*/\" 'n>" "\"public
\" (s type) \" get\" (jde-gen-init-cap (jde-gen-lookup-named 'name))" "\"() {return \"
(s name) \";}\" 'n> 'n>" "\"/**\" 'n>" "\"* Set the value of \" (s name) \".\" 'n>"
"\"* @param v Value to assign to \" (s name) \".\" 'n>" "\"*/\" 'n>" "\"public void
set\" (jde-gen-init-cap (jde-gen-lookup-named 'name))" "\"(\" (s type) \" v) {this.\"
(s name) \" = v;}\" 'n>")))
'(jde-compile-option-extdirs nil)
'(jde-db-option-verify (quote (nil t)))
'(jde-run-mode-hook nil)
'(jde-db-option-classpath (quote ("e:/jdk1_2_1/lib" "e:/java/tutorial")))
'(jde-compile-option-deprecation nil)
'(jde-db-startup-commands nil)
'(jde-gen-boilerplate-function (quote jde-gen-create-buffer-boilerplate))
'(jde-compile-option-classpath nil)
'(jde-build-use-make nil)
'(jde-quote-classpath t)
'(jde-gen-to-string-method-template (quote ("'&" "\"public String toString() {\" 'n>"
"\"return super.toString();\" 'n>" "\"}\" 'n>")))
'(jde-run-read-app-args nil)
'(jde-db-source-directories (quote ("e:/jave/tutorial/")))
'(jde-db-option-properties nil)
'(jde-db-option-stack-size (quote ((128 . "kilobytes") (400 . "kilobytes"))))
'(jde-db-set-initial-breakpoint t)
'(jde-run-option-application-args nil)
'(jde-gen-mouse-listener-template (quote ("'& (P \"Component name: \")"
"\".addMouseListener(new MouseAdapter() {\" 'n>" "\"public void
mouseClicked(MouseEvent e) {}\" 'n>" "\"public void mouseEntered(MouseEvent e) {}\"
'n>" "\"public void mouseExited(MouseEvent e) {}\" 'n>" "\"public void
mousePressed(MouseEvent e) {}\" 'n>" "\"public void mouseReleased(MouseEvent e)
{}});\" 'n>")))
'(jde-gen-console-buffer-template (quote ("(funcall jde-gen-boilerplate-function) 'n"
"\"/**\" 'n" "\" * \"" "(file-name-nondirectory buffer-file-name) 'n" "\" *\" 'n" "\"
*\" 'n" "\" * Created: \" (current-time-string) 'n" "\" *\" 'n" "\" * @author \"
(user-full-name) 'n" "\" * @version\" 'n" "\" */\" 'n>" "'n>" "\"public class \""
"(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" {\" 'n>
'n>" "\"public \"" "(file-name-sans-extension (file-name-nondirectory
buffer-file-name))" "\"() {\" 'n>" "'n>" "\"}\" 'n>" "'n>" "\"public static void
main(String[] args) {\" 'n>" "'p 'n>" "\"}\" 'n> 'n>" "\"} // \""
"(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "'n>")))
'(jde-compile-option-directory "")
'(jde-run-option-vm-args nil)
'(jde-make-program "make")
'(jde-compile-option-bootclasspath nil)
'(jde-use-font-lock t)
'(jde-db-option-garbage-collection (quote (t t)))
'(jde-appletviewer-option-vm-args nil)
'(jde-gen-class-buffer-template (quote ("(funcall jde-gen-boilerplate-function) 'n"
"\"/**\" 'n" "\" * \"" "(file-name-nondirectory buffer-file-name) 'n" "\" *\" 'n" "\"
*\" 'n" "\" * Created: \" (current-time-string) 'n" "\" *\" 'n" "\" * @author \"
(user-full-name) 'n" "\" * @version\" 'n" "\" */\" 'n>" "'n>" "\"public class \""
"(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" \"
(jde-gen-get-super-class) \" {\" 'n> 'n>" "\"public \"" "(file-name-sans-extension
(file-name-nondirectory buffer-file-name))" "\"() {\" 'n>" "'p 'n>" "\"}\" 'n>" "'n>"
"\"} // \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
"'n>")))
'(jde-compiler "javac")
'(jde-jdk-doc-url "http://www.javasoft.com/products/jdk/1.1/docs/index.html")
'(jde-db-debugger (quote ("jdb" . "Executable")))
'(jde-compile-option-verbose-path nil)
'(jde-run-option-classpath nil)
'(jde-key-bindings (quote (("" . jde-compile) ("" . jde-run) ("" . jde-db)
("" . jde-build) ("" . jde-run-menu-run-applet) ("" .
jde-db-menu-debug-applet) ("
" . bsh) ("" . speedbar-frame-mode) ("" . jde-wiz-implement-interface) ("" .
jde-wiz-import) ("" . jde-browse-jdk-doc) ("" . jde-save-project) ("" .
jde-gen-println))))
'(jde-gen-mouse-motion-listener-template (quote ("'& (P \"Component name: \")"
"\".addMouseMotionListener(new MouseMotionAdapter() {\" 'n>" "\"public void
mouseDragged(MouseEvent e) {}\" 'n>" "\"public void mouseMoved(MouseEvent e) {}});\"
'n>")))
'(jde-db-marker-regexp "^Breakpoint hit: .*(\\([^$]*\\).*:\\([0-9]*\\))")
'(jde-gen-property-change-support (quote ("'&" "\"protected PropertyChangeSupport pcs
= new PropertyChangeSupport(this);\" 'n>" "\"/**\" 'n>\"* Adds a
PropertyChangeListener to the listener list.\" 'n>" "\"* The listener is registered
for all properties.\" 'n>" "\"*\" 'n> \"* @param listener The PropertyChangeListener
to be added\" 'n> \"*/\" 'n>" "\"public void
addPropertyChangeListener(PropertyChangeListener listener) {\" 'n>"
"\"pcs.addPropertyChangeListener(listener);\" 'n> \"}\" 'n> 'n>" "\"/**\" 'n>\"*
Removes a PropertyChangeListener from the listener list.\" 'n>" "\"* This removes a
PropertyChangeListener that was registered for all properties.\" 'n>" "\"*\" 'n> \"*
@param listener The PropertyChangeListener to be removed\" 'n> \"*/\" 'n>" "\"public
void removePropertyChangeListener(PropertyChangeListener listener) {\" 'n>"
"\"pcs.removePropertyChangeListener(listener);\" 'n> \"}\" 'n> 'n>" "\"/**\" 'n>\"*
Adds a PropertyChangeListener for a specific property.\" 'n>"!
"\"
* The listener will be invoked only when a call on firePropertyChange\" 'n>" "\"*
names that specific property.\" 'n>" "\"*\" 'n> \"* @param propertyName The name of
the property to listen on\" 'n>" "\"* @param listener The PropertyChangeListener to be
added\" 'n> \"*/\" 'n>" "\"public void addPropertyChangeListener(String
propertyName,\" 'n>" "\"PropertyChangeListener listener) {\" 'n>"
"\"pcs.addPropertyChangeListener(propertyName, listener);\" 'n> \"}\" 'n> 'n>"
"\"/**\" 'n>\"* Removes a PropertyChangeListener for a specific property.\" 'n>"
"\"*\" 'n> \"* @param propertyName The name of the property that was listened on\"
'n>" "\"* @param listener The PropertyChangeListener to be removed\" 'n> \"*/\" 'n>"
"\"public void removePropertyChangeListener(String propertyName,\" 'n>"
"\"PropertyChangeListener listener) {\" 'n>"
"\"pcs.removePropertyChangeListener(propertyName, listener);\" 'n> \"}\" 'n> 'n>"
"\"/**\" 'n>\"* Reports a bound property update to any registered listen!
ers.
\" 'n>" "\"* No event is fired if old and new are equal and non-null.\" 'n>" "\"*\"
'n> \"* @param propertyName The programmatic name of the property that was changed\"
'n>" "\"* @param oldValue The old value of the property\" 'n>" "\"* @param newValue
The new value of the property.\" 'n> \"*/\" 'n>" "\"public void
firePropertyChange(String propertyName, Object oldValue, Object newValue) {\" 'n>"
"\"pcs.firePropertyChange(propertyName, oldValue, newValue);\" 'n> \"}\" 'n> 'n>"
"\"/**\" 'n>\"* Reports a bound property update to any registered listeners. \" 'n>"
"\"* No event is fired if old and new are equal and non-null.\" 'n>" "\"* This is
merely a convenience wrapper around the more general\" 'n>" "\"* firePropertyChange
method that takes Object values.\" 'n>" "\"* No event is fired if old and new are
equal and non-null.\" 'n>" "\"*\" 'n> \"* @param propertyName The programmatic name of
the property that was changed\" 'n>" "\"* @param oldValue The old value of the
property\!
" 'n
>" "\"* @param newValue The new value of the property.\" 'n> \"*/\" 'n>" "\"public
>void firePropertyChange(String propertyName, int oldValue, int newValue) {\" 'n>"
>"\"pcs.firePropertyChange(propertyName, oldValue, newValue);\" 'n> \"}\" 'n> 'n>"
>"\"/**\" 'n>\"* Reports a bound property update to any registered listeners. \" 'n>"
>"\"* No event is fired if old and new are equal and non-null.\" 'n>" "\"* This is
>merely a convenience wrapper around the more general\" 'n>" "\"* firePropertyChange
>method that takes Object values.\" 'n>" "\"* No event is fired if old and new are
>equal and non-null.\" 'n>" "\"*\" 'n> \"* @param propertyName The programmatic name
>of the property that was changed\" 'n>" "\"* @param oldValue The old value of the
>property\" 'n>" "\"* @param newValue The new value of the property.\" 'n> \"*/\" 'n>"
>"\"public void firePropertyChange(String propertyName, boolean oldValue, boolean
>newValue) {\" 'n>" "\"pcs.firePropertyChange(propertyName, oldValue, newValue)!
;\"
'n> \"}\" 'n> 'n>" "\"/**\" 'n>\"* Fires an existing PropertyChangeEvent to any
registered listeners.\" 'n>" "\"* No event is fired if the given event's old and new
values are equal and non-null. \" 'n>" "\"*\" 'n> \"* @param evt The
PropertyChangeEvent object.\" 'n>\"*/\" 'n>" "\"public void
firePropertyChange(PropertyChangeEvent evt) {\" 'n>" "\"pcs.firePropertyChange(evt);\"
'n> \"}\" 'n> 'n>" "\"/**\" 'n>\"* Checks if there are any listeners for a specific
property.\" 'n>" "\"*\" 'n> \"* @param evt The PropertyChangeEvent object.\" 'n>" "\"*
@return <code>true</code>if there are one or more listeners for the given property\"
'n>" "\"*/\" 'n>" "\"public boolean hasListeners(String propertyName) {\" 'n>"
"\"return pcs.hasListeners(propertyName);\" 'n> \"}\" 'n> 'n>")))
'(jde-run-working-directory "")
'(jde-gen-window-listener-template (quote ("'& (P \"Window name: \")"
"\".addWindowListener(new WindowAdapter() {\" 'n>" "\"public void
windowActivated(WindowEvent e) {}\" 'n>" "\"public void windowClosed(WindowEvent e)
{}\" 'n>" "\"public void windowClosing(WindowEvent e) {System.exit(0);}\" 'n>"
"\"public void windowDeactivated(WindowEvent e) {}\" 'n>" "\"public void
windowDeiconified(WindowEvent e) {}\" 'n>" "\"public void windowIconified(WindowEvent
e) {}\" 'n>" "\"public void windowOpened(WindowEvent e) {}});\" 'n>")))
'(jde-global-classpath nil)
'(jde-enable-abbrev-mode nil)
'(jde-gen-println (quote ("'&" "\"System.out.println(\" (P \"Print out: \") \");\"
'n>")))
'(jde-run-option-heap-profile (quote (nil "./java.hprof" 5 20 "Allocation objects")))
'(jde-db-read-app-args nil)
'(jde-db-option-verbose (quote (nil nil nil)))
'(jde-run-java-vm "java")
'(jde-read-compile-args nil)
'(jde-run-option-java-profile (quote (nil . "./java.prof")))
'(jde-compile-option-encoding nil)
'(jde-run-java-vm-w "javaw")
'(jde-compile-option-nowarn nil)
'(jde-gen-jfc-app-buffer-template (quote ("(funcall jde-gen-boilerplate-function) 'n"
"\"import java.awt.Dimension;\" 'n" "\"import java.awt.Graphics;\" 'n" "\"import
java.awt.Graphics2D;\" 'n" "\"import java.awt.Color;\" 'n" "\"import
java.awt.geom.Ellipse2D;\" 'n" "\"import java.awt.event.WindowAdapter;\" 'n" "\"import
java.awt.event.WindowEvent;\" 'n" "\"import javax.swing.JFrame;\" 'n" "\"import
javax.swing.JPanel;\" 'n" "\"import javax.swing.JScrollPane;\" 'n" "\"import
javax.swing.JMenuBar;\" 'n" "\"import javax.swing.JMenu;\" 'n" "\"import
java.awt.event.ActionEvent;\" 'n" "\"import javax.swing.AbstractAction;\" 'n 'n"
"\"/**\" 'n" "\" * \"" "(file-name-nondirectory buffer-file-name) 'n" "\" *\" 'n" "\"
*\" 'n" "\" * Created: \" (current-time-string) 'n" "\" *\" 'n" "\" * @author \"
(user-full-name) 'n" "\" * @version\" 'n" "\" */\" 'n>" "'n>" "\"public class \""
"(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\" extends
JFrame {\" 'n> 'n>" "\"c!
lass
Canvas extends JPanel {\" 'n> 'n>" "\"public Canvas () {\" 'n>"
"\"setSize(getPreferredSize());\" 'n>" "\"Canvas.this.setBackground(Color.white);\"
'n>" "\"}\" 'n> 'n>" "\"public Dimension getPreferredSize() {\" 'n>" "\"return new
Dimension(600, 600);\" 'n>" "\"}\" 'n> 'n>" "\"public void paintComponent(Graphics g)
{\" 'n>" "\"super.paintComponent(g);\" 'n>" "\"Graphics2D g2d = (Graphics2D) g;\" 'n>"
"\"Ellipse2D circle = new Ellipse2D.Double(0d, 0d, 100d, 100d);\" 'n>"
"\"g2d.setColor(Color.red);\" 'n>" "\"g2d.translate(10, 10);\" 'n>"
"\"g2d.draw(circle);\" 'n>" "\"g2d.fill(circle);\" 'n>" "\"}\" 'n> 'n>" "\"}\" 'n>
'n>" "\"public \"" "(file-name-sans-extension (file-name-nondirectory
buffer-file-name))" "\"() {\" 'n>" "\"super(\\\"\" (P \"Enter app title: \")
\"\\\");\" 'n>" "\"setSize(300, 300);\" 'n>" "\"addWindowListener(new WindowAdapter()
{\" 'n>" "\"public void windowClosing(WindowEvent e) {System.exit(0);}\" 'n>"
"\"public void windowOpened(WindowEvent e) {}});\" 'n!
>" "
\"setJMenuBar(createMenu());\" 'n>" "\"getContentPane().add(new JScrollPane(new
Canvas()));\" 'n>" "\"}\" 'n>" "'n>" "\"public static void main(String[] args) {\"
'n>" "'n>" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))" "\"
f = new \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
"\"();\" 'n>" "\"f.show();\" 'n>" "'p 'n>" "\"}\" 'n> 'n>" "\"protected JMenuBar
createMenu() {\" 'n>" "\"JMenuBar mb = new JMenuBar();\" 'n>" "\"JMenu menu = new
JMenu(\\\"File\\\");\" 'n>" "\"menu.add(new AbstractAction(\\\"Exit\\\") {\" 'n>"
"\"public void actionPerformed(ActionEvent e) {\" 'n>" "\"System.exit(0);\" 'n>"
"\"}\" 'n>" "\"});\" 'n>" "\"mb.add(menu);\" 'n>" "\"return mb;\" 'n>" "\"}\" 'n> 'n>"
"\"} // \"" "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
"'n>")))
'(jde-db-option-application-args nil)
'(jde-gen-buffer-boilerplate nil)
'(jde-db-option-heap-size (quote ((1 . "megabytes") (16 . "megabytes"))))
'(jde-compile-option-verbose nil)
'(jde-mode-abbreviations (quote (("ab" . "abstract") ("bo" . "boolean") ("br" .
"break") ("by" . "byte") ("byv" . "byvalue") ("cas" . "cast") ("ca" . "catch") ("ch" .
"char") ("cl" . "class") ("co" . "const") ("con" . "continue") ("de" . "default")
("dou" . "double") ("el" . "else") ("ex" . "extends") ("fa" . "false") ("fi" .
"final") ("fin" . "finally") ("fl" . "float") ("fo" . "for") ("fu" . "future") ("ge" .
"generic") ("go" . "goto") ("impl" . "implements") ("impo" . "import") ("ins" .
"instanceof") ("in" . "int") ("inte" . "interface") ("lo" . "long") ("na" . "native")
("ne" . "new") ("nu" . "null") ("pa" . "package") ("pri" . "private") ("pro" .
"protected") ("pu" . "public") ("re" . "return") ("sh" . "short") ("st" . "static")
("su" . "super") ("sw" . "switch") ("sy" . "synchronized") ("th" . "this") ("thr" .
"throw") ("throw" . "throws") ("tra" . "transient") ("tr" . "true") ("vo" . "void")
("vol" . "volatile") ("wh" . "while"))))
'(jde-make-args "")
'(jde-gen-code-templates (quote (("Get Set Pair" . jde-gen-get-set) ("toString
method" . jde-gen-to-string-method) ("Action Listener" . jde-gen-action-listener)
("Window Listener" . jde-gen-window-listener) ("Mouse Listener" .
jde-gen-mouse-listener) ("Mouse Motion Listener" . jde-gen-mouse-motion-listener)
("Inner Class" . jde-gen-inner-class) ("println" . jde-gen-println) ("property change
support" . jde-gen-property-change-support)))))