I'm going to be conservative and say no, Emacs is not a drop-in replacement for Eclipse (especially not out of the box). However, that doesn't mean that it's not suitable for Java development.
Since you are already familiar with Eclipse I suggest you have a look at eclim:
Eclim provides the ability to access Eclipse code editing features (code completion,...
You can't directly write an Emacs package in Java. There is currently no way to extend Emacs in Java, nor is there a Java to Elisp transpiler.
It's common, though, to have Emacs run other programs to do work for it. You could write a helper program like this in Java. Whether this makes sense depends on what exactly you intend to do.
Emacs/eclim has been my primary Java IDE for the last couple of years and would say it works fairy well, even with large code bases (my current emacs/eclim workspace has more than 4000 Java files). It's true that emacs-eclim requires the file to be saved before making its call to eclimd, but it's not that big of a problem IMO. The editing experience is still ...
At this point(2018), LSP Java(https://github.com/emacs-lsp/lsp-java) is pretty good. Few of the features:
Refactoring (extract method, rename, implement interface, extract local, extract constant and so on.)
Code navigation while working on multiple projects
Find references, implementations, open type.
Maven/Gradle project import, ...
which-function-mode displays the current method name.
The following configuration, which I got from Emacs Redux, displays the current method / function / orgmode heading in the top header line rather than the mode line:
;; Show the current function name in the header line
Here's a little snippet that allows to run a single Java file:
(defun java-eval-nofocus ()
"Run current Java file."
(let* ((source (file-name-nondirectory buffer-file-name))
(out (file-name-sans-extension source))
(class (concat out ".class")))
(setenv "CLASSPATH" default-directory)
Disclaimer: I'm not that familiar with cc-mode styles, so there might be simpler ways to do that, and also unforeseen side-effects to my code.
(defun my-java-lineup-cascaded-calls (langelem)
(let ((operator (and (looking-at "\\.")
(regexp-quote (match-string 0))))
After some poking around, it looks like this has fixed it (getting called in java-mode-hook):
(c-set-offset 'inexpr-class 0)
By default it is set to +. inexpr-class controls the indentation level for anonymous classes and anonymous initialisation.
I would suggest Meghanada. It is light weighted, much easier to setup (compared to JDEE). It is not mature enough, but already supports auto-completion, syntax-checking and runs junit tests. It will also parse maven and gradle projects automatically. The overall experience is smooth enough for small and moderate scale projects. Refactoring support is still ...
Find full directory path where emacs expects ditaa.jar to be located.
This code is copied from ob-ditaa.el
I am afraid that moving files manually will mess up my system, confuse my package manager and only work until the next update. Instead, you can simply added the true path for ditaa.jar to your .emacs or .emacs.d/init.el. In my case:
(setq org-ditaa-jar-path "/usr/share/ditaa/lib/ditaa.jar")
You can use describe-char or C-u C-x = (= what-cursor-position with a prefix arg) to obtain a buffer giving as much information as possible about the character at point : font, syntax, properties and, of course, faces.
If not too unlucky, the name of the face will give you the library name that added it.
I recommend you having look at emacs-eclim. It uses Eclipse as a backend and provides many feature you'd want, like context aware auto-completion, correction-suggestions, documentation lookup and source navigation.
To give you an overview: So to set it up with an existing project, do $ mvn eclipse:eclipse inside your project, then open up Eclipse and do a "...
so why is this the only file missing?
Because the CEDET guys feel that the Java support hasn't received enough attention (development, testing, adoption) to be ready for inclusion into Emacs.
To use it, you'll have to install the upstream CEDET, or maybe Alex Ott's branch (see this question and answer).
And what can I do to fix it?
Show some activity ...
I saw that you already solved this, but I thought that I could share the following anyway:
You can use Font-lock studio (an interactive debugger for font-lock keywords) to single step each font-lock rule using the n command. That way, you can easily see which one caused the problem. If you are lucky and the rule contains a function call (instead of a plain ...
How embarrassing. A few minutes after asking the question, the solution came to me. I might make the case that the asking of the question led to the solution, though.
In any case, the answer that came to me is that I should find the face description using a character in the pinkish text. This led to using M-x describe-face which put a query into the ...
You can do that using https://github.com/emacs-lsp/lsp-java by setting lsp-java-format-settings-url to https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml
(setq lsp-java-format-settings-url "https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml")
Edit: the correct url must be raw https://raw....
ATM there are no manual instructions, please open an issue in lsp-java repo. To fix your problem do:
M-x lsp-java-update-server - do that to force lsp-java to download the install pom.xml and cancel the task.
In the *Messages* buffer there will be something like this:
It seems that ensime requires the src.zip file to be in the JAVA_HOME directory, the error message is misleading.
On Ubuntu 16.04 and with Java 8 you can get this by running sudo apt-get install openjdk-8-source. It's probably something similar on other OSes.
I don't know if you'd consider it "lightweight," but I've had good luck with eclim. It uses eclipse for the heavy lifting, but it also integrates well with eclipse's project management. It has company integration that works well.
There's a bit to learn, but not a whole lot. It works well to reduce the pain of working with Java in Emacs to just the pain ...
This problem is solved.
Thanks to Phil Newton (sodaware) for creating this extension to integrate with PHP_beautifier.
This application was released 5 hours ago (on March 28, 2017).
I have tried some of my PHP Code, and it works well.
This is some gif from when I gave it a try.
In addition to what @YoungFrog offered, you can often find what a given face is at places where you cannot put the cursor, by using M-x list-faces-display.
That will show you all faces currently defined, WYSIWYG, and that will usually enable you to narrow the list of faces that it could be.
It can become a bit more complicated when faces are merged (...
Base on Melioratus answer I did this:
cd .emacs.d/elpa && mkdir contrib
cd contrib %% mkdir scripts
which ditaa ## I have mine in /usr/local/bin
ln -s /usr/local/bin/ditaa0_9.jar ditaa.jar
ln -s /usr/local/bin/DitaaEps.jar DitaaEps.jar
Now emacs/ org-babel can find ditaa, success!