(defun my-switch-to-java-implementation (packagename classname) "Tries to switch to the java source file containing the package packagename and the class classname." (with-temp-buffer (shell-command-to-string (format "%s %s -iname '*.java' | xargs egrep -l '%s' | sort -u | xargs egrep -l 'class %s' | head -n 1" "find" "path/to/your/java/sources" packagename classname ) (current-buffer) ) (if (= (count-lines (point-min) (point-max) ) 1) (progn (search-forward "\n") (replace-match "") (find-file (buffer-string)) ) (message "Could not find suitable implementation.") ) ) ) (defun my-switch-to-java-implementation-at-point () "Tries to switch to the java source file which contains the package and class imported in the current line." (interactive) (save-excursion (beginning-of-line) (if (looking-at "^import \\(.*\\)\\.\\(.+\\);$") (let ( (packagename (buffer-substring (match-beginning 1) (match-end 1) ) ) (classname (buffer-substring (match-beginning 2) (match-end 2) ) ) ) (my-switch-to-java-implementation packagename classname) ) (message "This is not an import") ) ) )You basically call my-switch-to-java-implementation-at-point (e.g. by binding it to a key) when you are on the import line. Emacs then launches find and grep to look for the definition of your class. Of course, using something like GNU Global would be faster, but also a bit more tricky, since it does not use the packagename, but rather only the class name, which might be used multiple times in your project.
Also note that you have to set the path to your Java source files. I suggest you make a customizable variable of that, or use your ede-project-root or something similar.