Using cscope with Emacs to browse Java source codes.
cscope can be used to browse Java symbols too. Use these commands at the top-level directory to create the index:
Enter into the source directory. Here I want to browse android source code. Hence I will cd into android source directory then execute below commands.
$ find . -name “*.java” > cscope.files
$ cscope -b
Then add this line at the bottom of xcscope.el to load cscope-mode whenever a Java file is opened:
(add-hook ‘java-mode-hook (function cscope:hook))
In my system the xcscope.el is located in /usr/share/emacs/site-lisp/xcscope.el
Then use the xcscope in emacs as usual. If you are using a single command cscope-indexer -r to gnerate the cscoape database then use the below hack.
sudo cp /usr/bin/cscope-indexer /usr/bin/cscope-indexer-java
sudo vim /usr/bin/cscope-indexer-java
search for a line similar to “egrep -i ‘\.([chly](xx|pp)*|cc|hh)$’ | \“ and modifiy it as below
egrep -i ‘\.([chly](xx|pp)*|cc|hh|java)$’ | \
Now you can use a single command to genateate the database. Goto the source directory and use below command.
$ cscope-indexer-java -r




