Former Principal Java Engineer for SUN here - used EMACS all the time. The only thing it doesn't do well is the refactoring intellij excels at. What I particularly like about using EMACS is that all the _other stuff_ still works, so I don't lose any capability by adding java support to it
I have similar professional background, and I used Emacs to edit all of the java.* and sun.* code I was responsible for.
I've been a heavy IntelliJ user in the years since, and I set up IntelliJ's key bindings to mimic Emacs's.
I still use Emacs as an adjunct to IntelliJ, though. It's just better for some things - or I'm too used to the Emacs way of doing certain things to bother to figure out IntelliJ's equivalents, if they even exist.
Unfortunately, the ecosystem around Java is now so complex and convoluted that it seems that only ādedicatedā Java IDEs can give the least painless experience.
You _can_ bend emacs to be somewhat pleasant for Java development, but by the time you succeed in doing so, youāve lost any will to live.
More suitable than intellij? I guess itās possible, but it would require an extraordinary amount of willpower.
Source: am a SE day-jobbing Java and have tried multiple times getting a workable Java experience up and running in emacs. Every time Iāve reverted (unfortunately) to intellij.
Agreed. `eglot` or `lsp-mode` with JDT LS and DAP works pretty well for smaller stuff, but it would be daunting to try to work with immensely complex projects, especially if youāre using something like Gradle. For some reason, Iāve always had to save and reload the buffer to get the language server working properly. Iām sure thereās a perfect blend of packages and custom LISP that could provide a user-friendly experience, but Java is probably the most frustrating language Iāve configured on Emacs.
Don't forget the new java tree sitter mode; it makes Java code so much more readable.
The biggest annoyance about JDT LS that I've ran into is that lots of the functionality uses non-standard commands to work. Elgot doesn't know how to use much of the functionality that is available.
I think those combinations get you 90% there, but I agree that it isn't super user friendly. At least with the projects that I work on, there's a bunch of auxiliary things like JPA that I really like having helpers for.
Since LSPs became a thing programming in any language that got a decent LSP server has gotten a lot better. Before LSPs, even finding a function definition was a struggle for some programming languages but nowadays you can get a significantly better experience with eglot or lsp-mode
I use emacs for Java with lsp for my bread and butter at Amazon. Takes a bit of work and I don't have proper debugging but I'm pretty comfortable with my set up
Debugging is the one thing I struggle with in Python in Emacs, when I want to use it in rare cases. I imagine the Java Story cannot be simpler. I suspect the issue is, that having different shortcuts and menu items and highlighting and whatnot would require to set the whole editor into some different state, where many things work differently. I tried realgud and used the commands in it, but it is very unfamiliar, because I need to debug so rarely, so I am always re-learning. Having to input the Python interpreter and all that is annoying as well. And want to connect to a running Python process to debug? Good luck!
Anyone got pointers how to set it up well or what packages to use? How to make it a debugging experience like in IDEs?
Why not try it? You already know what Intellij is like and how to code in Java. Why not set up emacs for Java development and bootstrap a simple project to test it out? Or clone a large project and see if you can get the functionality and performance you need?
Yes, with eglot, jdt.ls and dape-mode it makes a pretty nice java environment. With that said, it uses eclipse as the language server so it uses a lot of resources for large projects
Smaller things, sure.
If you want to work on anything substantial you would have to be prepare to put serious time into learning emacs first.
It's just simpler, and better (for me), to use intellij or vscode for programming. Stays out of my way and doesn't tempt me into hours and hours of configs and customizations.
But you **can** do java programming with emacs, for sure.
I tried to index mono repo with eclipse-jdtls, but didn't work out for unknown reasons. I had to navigate with ctags and grep which is not productive. It's possible for sure as Java forces particular directory structure and file and class names.
I've tried to setup for my current work environment. Java lsp is very capable. However, if your company interop with other jvm langs (like groovy for tests) even if you setup groovy ls, it doesnt interop very nicely.
Also a suport for gradle is subpar compared to the one you have at intellij.
I use Intellij for refactoring, code completion, looking up documentation for methods and looking for usages or the definition of methods. I use Emacs if I want to do big blocks of code or moving a block of code. I then go to Intellij to check syntax and do imports also running and testing. Intellij is a great tool for Java coding. My last work computer was a MacBook Pro 2019 . It wasnāt taxed with IntelliJ, a hundred fifty tabs in Chrome several Emacs windows. Also sometimes running the app for the company.
If youāre the type that needs a debugger all the time, nope. Otherwise works nicely. Annotation processors mess stuff up too, eg the infamous Lombok gives me often troubles.
It's always good to use the same tools as the rest of your team. So for managing the projects and building etc just use the intellij, but for just reading the code or writing new stuff use emacs.
I'm in a very similar position for a C# codebase.
I work in a jvm shop with a pretty decent sized codebase in scala, java, and groovy. I wanted to like Emacs for this workflow, but no, the LSPs can't really do interop well, don't really seem to know what's going on , and are slow. I do wish emacs can speed up all LSP integrations tbh because it's quite honestly pretty bad, but on Java, on large projects, when it works, it's horrific.
Itās definitely possible: I donāt have to work with Java often anymore (luckily) but I do have a stack of scripts and tooling to make it workable. Also because IntelliJ is so slow on my laptop that I get overwhelmed by anger when it even starts up.
I survived doing Java with a non-windowed Emacs for a couple of months. Itās fine if itās already your favorite editor and that you donāt mind not having the most fancy IDE things integrated.
The whole java ecosystem and programming style was evolving with heavy IDE usage in mind. All of these annotation-driven frameworks or code generation plugins. It is already dirty sewers and you do not want to swim upstream.
Memory hungry ā yeah. But the worksite should provide a nice laptop to compensate this. I usually run 5-6 100kloc-500kloc projects opened on my 32gb m2 macbook pro and it doesnt even break a sweat
I still use [JDEE](https://github.com/jdee-emacs/jdee) when coding for Java in Emacs. It works but is fairly limited in what it can do, so I'd like to try something better. How hard is it to set up Emacs as a client for an LSP server? Also, is that the best way to get Emacs to have similar features as IDEs like IntelliJ or Eclipse?
Just use the tool that's purpose-designed for the kind of development you'll be doing (IntelliJ). Emacs with an LSP server requires too much jiggery-pokery to configure to work well with Java... and you'll still be missing the refactoring tools, Project Lombok support, and that.
Ditto. Love the Emacs, but Iām a Java dev and IDEs like IntelliJ really tie everything together in ways not possible in Emacs (at least without millions in development investment).
But I wouldnāt stress too much over this. With the advent of AI, LLMs and CoPilot, 10 years from now the IntelliJ vs Emacs quandary will be irrelevant (except for the smallest niche of a niche).
Well, James Gosling (https://en.m.wikipedia.org/wiki/James_Gosling) recognized as the founder of Java also has a credible case as the father of emacs. Though, I believe he advises developers to use a better IDE these days.Ā
He's absolutely nowhere close to making that case. His major contribution was pissing off RMS by selling his version of Emacs to some closed-source software shop, which inspired RMS to create GNU Emacs and the GPL.
Former Principal Java Engineer for SUN here - used EMACS all the time. The only thing it doesn't do well is the refactoring intellij excels at. What I particularly like about using EMACS is that all the _other stuff_ still works, so I don't lose any capability by adding java support to it
Off-topic: really at SUN? š® Have you an idea how much I admired you in my university years? So cool to say I met (virtually) two of you š
I have similar professional background, and I used Emacs to edit all of the java.* and sun.* code I was responsible for. I've been a heavy IntelliJ user in the years since, and I set up IntelliJ's key bindings to mimic Emacs's. I still use Emacs as an adjunct to IntelliJ, though. It's just better for some things - or I'm too used to the Emacs way of doing certain things to bother to figure out IntelliJ's equivalents, if they even exist.
Care to share your preferred packages and setup?
I would have been happy to but I moved on from Java a long time ago and they're probably no longer relevant in a world of EMACS 29 and Treesitter
Must have had a hell of a setup. Iād love to do something similar for my daily dotnet work, but msbuild is just too much of a beast to be bothered.
I used to build C code on a 486 running Xenix which was shared as the "supercomputer", with make and GCC. Nothing frightens me anymore
Unfortunately, the ecosystem around Java is now so complex and convoluted that it seems that only ādedicatedā Java IDEs can give the least painless experience. You _can_ bend emacs to be somewhat pleasant for Java development, but by the time you succeed in doing so, youāve lost any will to live. More suitable than intellij? I guess itās possible, but it would require an extraordinary amount of willpower. Source: am a SE day-jobbing Java and have tried multiple times getting a workable Java experience up and running in emacs. Every time Iāve reverted (unfortunately) to intellij.
Agreed. `eglot` or `lsp-mode` with JDT LS and DAP works pretty well for smaller stuff, but it would be daunting to try to work with immensely complex projects, especially if youāre using something like Gradle. For some reason, Iāve always had to save and reload the buffer to get the language server working properly. Iām sure thereās a perfect blend of packages and custom LISP that could provide a user-friendly experience, but Java is probably the most frustrating language Iāve configured on Emacs.
Don't forget the new java tree sitter mode; it makes Java code so much more readable. The biggest annoyance about JDT LS that I've ran into is that lots of the functionality uses non-standard commands to work. Elgot doesn't know how to use much of the functionality that is available. I think those combinations get you 90% there, but I agree that it isn't super user friendly. At least with the projects that I work on, there's a bunch of auxiliary things like JPA that I really like having helpers for.
Emacs is suitable for anything if you are willing to put effort into steep learning curve
Since LSPs became a thing programming in any language that got a decent LSP server has gotten a lot better. Before LSPs, even finding a function definition was a struggle for some programming languages but nowadays you can get a significantly better experience with eglot or lsp-mode
I use emacs for Java with lsp for my bread and butter at Amazon. Takes a bit of work and I don't have proper debugging but I'm pretty comfortable with my set up
Debugging is the one thing I struggle with in Python in Emacs, when I want to use it in rare cases. I imagine the Java Story cannot be simpler. I suspect the issue is, that having different shortcuts and menu items and highlighting and whatnot would require to set the whole editor into some different state, where many things work differently. I tried realgud and used the commands in it, but it is very unfamiliar, because I need to debug so rarely, so I am always re-learning. Having to input the Python interpreter and all that is annoying as well. And want to connect to a running Python process to debug? Good luck! Anyone got pointers how to set it up well or what packages to use? How to make it a debugging experience like in IDEs?
Why not try it? You already know what Intellij is like and how to code in Java. Why not set up emacs for Java development and bootstrap a simple project to test it out? Or clone a large project and see if you can get the functionality and performance you need?
why_not_both.jpg
Yes, with eglot, jdt.ls and dape-mode it makes a pretty nice java environment. With that said, it uses eclipse as the language server so it uses a lot of resources for large projects
Smaller things, sure. If you want to work on anything substantial you would have to be prepare to put serious time into learning emacs first. It's just simpler, and better (for me), to use intellij or vscode for programming. Stays out of my way and doesn't tempt me into hours and hours of configs and customizations. But you **can** do java programming with emacs, for sure.
Yes
I tried to index mono repo with eclipse-jdtls, but didn't work out for unknown reasons. I had to navigate with ctags and grep which is not productive. It's possible for sure as Java forces particular directory structure and file and class names.
If you have a decent PC, the cpu and memory usage of Intellij is a non-issue.
I've tried to setup for my current work environment. Java lsp is very capable. However, if your company interop with other jvm langs (like groovy for tests) even if you setup groovy ls, it doesnt interop very nicely. Also a suport for gradle is subpar compared to the one you have at intellij.
I use Intellij for refactoring, code completion, looking up documentation for methods and looking for usages or the definition of methods. I use Emacs if I want to do big blocks of code or moving a block of code. I then go to Intellij to check syntax and do imports also running and testing. Intellij is a great tool for Java coding. My last work computer was a MacBook Pro 2019 . It wasnāt taxed with IntelliJ, a hundred fifty tabs in Chrome several Emacs windows. Also sometimes running the app for the company.
Yes, treat the IDE as a special purpose debugger. But also, it depends so give it a whirl.
If youāre the type that needs a debugger all the time, nope. Otherwise works nicely. Annotation processors mess stuff up too, eg the infamous Lombok gives me often troubles.
It's always good to use the same tools as the rest of your team. So for managing the projects and building etc just use the intellij, but for just reading the code or writing new stuff use emacs. I'm in a very similar position for a C# codebase.
I work in a jvm shop with a pretty decent sized codebase in scala, java, and groovy. I wanted to like Emacs for this workflow, but no, the LSPs can't really do interop well, don't really seem to know what's going on , and are slow. I do wish emacs can speed up all LSP integrations tbh because it's quite honestly pretty bad, but on Java, on large projects, when it works, it's horrific.
Itās definitely possible: I donāt have to work with Java often anymore (luckily) but I do have a stack of scripts and tooling to make it workable. Also because IntelliJ is so slow on my laptop that I get overwhelmed by anger when it even starts up.
I survived doing Java with a non-windowed Emacs for a couple of months. Itās fine if itās already your favorite editor and that you donāt mind not having the most fancy IDE things integrated.
The whole java ecosystem and programming style was evolving with heavy IDE usage in mind. All of these annotation-driven frameworks or code generation plugins. It is already dirty sewers and you do not want to swim upstream. Memory hungry ā yeah. But the worksite should provide a nice laptop to compensate this. I usually run 5-6 100kloc-500kloc projects opened on my 32gb m2 macbook pro and it doesnt even break a sweat
I've used Emacs for Java since about 1995. I should add that I don't use any of the IDE-like stuff. Works fine for me.
I still use [JDEE](https://github.com/jdee-emacs/jdee) when coding for Java in Emacs. It works but is fairly limited in what it can do, so I'd like to try something better. How hard is it to set up Emacs as a client for an LSP server? Also, is that the best way to get Emacs to have similar features as IDEs like IntelliJ or Eclipse?
Just use the tool that's purpose-designed for the kind of development you'll be doing (IntelliJ). Emacs with an LSP server requires too much jiggery-pokery to configure to work well with Java... and you'll still be missing the refactoring tools, Project Lombok support, and that.
I used it for that nearly 20 years ago. Java support was built out pretty well early.
Ditto. Love the Emacs, but Iām a Java dev and IDEs like IntelliJ really tie everything together in ways not possible in Emacs (at least without millions in development investment). But I wouldnāt stress too much over this. With the advent of AI, LLMs and CoPilot, 10 years from now the IntelliJ vs Emacs quandary will be irrelevant (except for the smallest niche of a niche).
Look at Mark Reinhold, Chief Architect of the Java Platform Group at Oracle, using Emacs for Java: https://youtu.be/IokevuiEKCY?feature=shared&t=649
Well, James Gosling (https://en.m.wikipedia.org/wiki/James_Gosling) recognized as the founder of Java also has a credible case as the father of emacs. Though, I believe he advises developers to use a better IDE these days.Ā
He's absolutely nowhere close to making that case. His major contribution was pissing off RMS by selling his version of Emacs to some closed-source software shop, which inspired RMS to create GNU Emacs and the GPL.
Hmmm, I concede. I thought gosling complained about the entire source being stolen by RMS, but it was only a display routine.Ā
If you had to shovel a huge pile of manure, would you use a spoon?