-** Java
-*** Evaluate current buffer
-Stolen from https://stackoverflow.com/questions/19953924/how-do-you-run-java-codes-in-emacs
-#+begin_src emacs-lisp
- (defun java-eval-buffer ()
- "run current program (that requires no input)"
- (interactive)
- (let* ((source (file-name-nondirectory buffer-file-name))
- (out (file-name-sans-extension source))
- (class (concat out ".class")))
- (save-buffer)
- (shell-command (format "rm -f %s && javac %s" class source))
- (if (file-exists-p class)
- (shell-command (format "java %s" out) "*scratch*")
- (progn
- (set (make-local-variable 'compile-command)
- (format "javac %s" source))
- (command-execute 'compile)))))
-#+end_src