I have an ant project I'd like to work on in Emacs. For that, I have been trying to set up Emacs to act like a Java IDE. I installed eclipse by sudo snap install --classic eclipse
and then followed the instructions on eclim's website to install eclim.
Finally I installed emacs-eclim using the emacs package manager (from MELPA).
Here are my eclim configurations,
(use-package eclim
:ensure t
:init
(setq eclim-executable "~/.eclipse/360744286_linux_gtk_x86_64/eclimd")
(setq eclim-eclipse-dirs "/snap/eclipse/current")
(require 'eclim)
(setq eclimd-autostart t)
(defun my-java-mode-hook ()
(eclim-mode t))
(add-hook 'java-mode-hook 'my-java-mode-hook))
Though whenever I open a java file (which tries to run eclim-mode
) or run any other eclim Emacs commands, I get the following error,
File mode specification error: (error /usr/bin/java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
JAVA_VERSION=11
/usr/bin/java -command ping -Dosgi.requiredJavaVersion=1.8 -Dosgi.instance.area.default=@user.home/eclipse-workspace -XX:+UseG1GC -XX:+UseStringDeduplication --add-modules=ALL-SYSTEM -Dosgi.dataAreaRequiresExplicitInit=true -Xms256m -Xmx1024m -jar /snap/eclipse/current/plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar --launcher.suppressErrors -debug -clean -refresh -application org.eclim.application
Unrecognized option: -command
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
)
I have checked my javac
and java
on a simple hello world program and they work fine.