Developing in Java Without an IDE
In my journey away from the mouse and trackpad, I found Neovim recommended often. Having developed in Java for over 13 years, I’ve relied heavily on IDEs like IntelliJ or NetBeans for most of that time. I decided to step outside those walls to see what lay beyond.
Setting up
I began by installing Neovim.
Inside the nvim configuration directory (~/.config/nvim), I cloned this repository, which provides a kickstart configuration for nvim-java.
This setup offers a default environment for Springboot Java development as wel as support for lombok.
Initially, it took some time for Neovim to install all the required libraries and launch the Java Language Server (JDTLS). Overall, the installation experience was quite seamless. In my evaluation of Neovim, I did not make any additional configuration changes, as I wanted to assess the out-of-the-box experience.
Evaluating the functionality
Running your app
To run your application and view its output, use the command :JavaRunnerRunMain.
You can stop the application with :JavaRunnerStopMain.
Autocompletion
Just like IntelliJ, Neovim provides good autocompletion capabilities.
Jumpt to definition
You can navigate to the reference file using the gf command.
However, this doesn’t work as smoothly for dependency classes or when jumping to specific methods within a class.
From what I’ve seen, it is possible to get this functionality working as expected.
Syntax highlighting
Syntax highlighting, compilation warnings, and error detection work as expected.
Debugging
Debugging unit tests can be done using DAP.
Breakpoints can be toggled and multiple breakpoints can be cleared with the :DapToggleBreakpoint and :DapClearBreakpoints commands, respectively.
To start a debug session, use :JavaTestDebugCurrentClass or :JavaTestDebugCurrentMethod.
This will open a window displaying the current debug state.
Refactoring
Refactoring commands are available to assist with code refactoring. While Neovim doesn’t have all the features of IntelliJ, the most commonly used functions are present.
Mouse functionality
While Neovim is designed for keyboard-centric workflows, the ability to select text using the mouse serves as a useful fallback when needed.
Tests
To execute tests for the current class, use :JavaTestRunCurrentClass or :JavaTestRunCurrentMethod to run tests for the current method.
By running the command :JavaTestViewLastReport the results of the above tests can be viewed.
Conclusion
While the transition isn’t entirely seamless and some tasks, like refactoring and making larger changes, remain easier in IntelliJ, the experience was far better than I anticipated. The learning curve for commands and shortcuts does add some mental overhead, and getting into the flow of development takes a bit more effort.
However, the flexibility and efficiency of Neovim make it a compelling alternative for Java development.