简体   繁体   中英

Ensime inferior scala mode

I've setup Emacs + Ensime for scala.

I'm able to start sbt console inside emacs using Cc Cv s

If i start scala console inside emacs using Cc Cv z, I get the following error

Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_33).
scala> 
Failed to initialize compiler: class scala.reflect.BeanInfo not found

What is the fix for this error? How do i get scala console running inside Emacs?

I've ran into a similar error recently, but here's how I worked around it (but I don't know how to fix it, so this is only half the answer). What I did was to customize the ensime-inf-default-cmd-line variable to have the value: '("sbt" "console") . Which will indeed start the interactive Scala environment.

EDIT:

Here's relevant parts from .emacs , but I'm not sure it will matter / will be the same in every install:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 ;;
 ;; more stuff ...
 ;; I'm not sure this line is correct / makes any difference
 '(ensime-inf-cmd-template (quote ("sbt" "console" "-classpath" :classpath)))
 ;; This variable is used to launch the interpreter
 '(ensime-inf-default-cmd-line (quote ("sbt" "console"))))

(require 'scala-mode2)
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))
(add-to-list 'load-path "~/.emacs.d/ensime/elisp/")
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)

I've installed scala-mode2 from MELPA. Installed sbt version 0.12.0 by downloading an RPM from their site. I had previously JRE and JDK installed, the active version is OpenJDK 1.7. Scala installed is 2.9.2. I don't know how to identify Ensime's version :|

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM