I don't know if I have a learning disability or what, but learning Java is -hard-. Let's take simple web development in Java, for example. Even if you're familiar with web development in a different language, a simple Java application with a database requires you learn: JDBC, servlets, POJOs, JSP and Tomcat. Then! If you're interested in automating your build.. you know, compiling your code and moving it into the right directories in Tomcat, you have to learn Make or Ant. That's a tall order!
All of these items are distractions from my real goal: writing Java. But what should you use to write Java? I've heard Eclipse is nice, but Sun offers you NetBeans when you download the JDK. However, my friend use gVim for -everything-, but that's not really usable on Windows. What's a Java noob to do?
In the last two weeks I've tried a number of editors and IDE's trying to find something that helps me program in Java. My requirements for a "good" editor are:
- Line numbering
- Syntax highlighting
- Code folding
- The ability to compile Java and view the errors from within the editor
- Relatively easy to use
- Preferrably OSS
- Must run on Linux
- Ant integration, or some way to build the project and put the compiled crap where it belongs
- Source code control integration
Below is a list of some of the more popular programs I evaluated, I will try to list them from simplest to most feature-rich.
1. vi
The original fall-back editor, not vim, but vi. Barebones and straight to the point, with no frills to distract you from what you're doing: editing something. Every day I'm editing documents in vi, even when I have other tools that are better-suited for editing, it's just too simple not to fall back on. However, anything more than a quick fix and I'll resort to another editor, but vi still kicks butt. Just don't plan on doing anything fancy like syntax highlighting, code folding or anything else in it.
2. gVim (gvim.org)
I've used vi for years on commercial Unix systems, but I'm far from a vi expert. However, vim is "vi, improved" so you get a metric ton of new features, most of them awesome, all of them with strange key bindings. My buddy JJ swears by gVim, it's the only editor I've ever seen him use, and consequently he knows it like the back of his hand.
However, gVim is just an editor. A great editor, to be sure, but it didn't really provide me the user experience I was looking for. Trying to memorize all the various key combos to do what I wanted was just too much on top of all the other crap I was trying to learn. It served as a distraction.. and I couldn't compile from within it. It's still vi at heart, no matter how you slice it. I'll still use gVim for Python, the development process lends itself nicely to having a Python shell open next to a gVim window. Go figure.
3. jEdit 4.2 (http://jedit.org)
jEdit came highly recommended, many people told me it was their favorite editor! It has a TON of plug-ins to do pretty much everything I wanted, but I admit I didn't spend much time to figure them out. Overall, it's a really good editor, but a bit quirky. I liked the alt+arrow key combo for indenting code, but it didn't always grab the last line I selected. I also couldn't figure out code-folding, it never seemed to work. Additionally, when I used Compiz the window wouldn't resize, it was stuck. This is a known bug, but still annoying. Lastly, it's kind of ugly, but still far more professional than Notepad++. I'd use this editor again with no complaints.
4. Eclipse 3.2 (http://eclipse.org)
When I think "Java IDE", I naturally think of Eclipse. Behind this IDE is a large and active community, decent documentation and a whole ton of functionality.
I had used Eclipse in the past, but found it to be really complicated to set up.. but that was years ago, certainly it's better now, right? Not really. It's still huge, and learning how to use it is another item on my to-do list. I used it for about a week, but never figured out how to get the build process working so it moved crap into Tomcat for me. Worse, I found it to be pretty slow on my machine (1.4ghz laptop with 1.5gig ram). I don't know, maybe it's just me, but I want my editor to be responsive. However, it had all the features I wanted and more, just too steep of a learning curve for my taste.
5. NetBeans 6.0 (netbeans.org)
NetBeans is my new IDE of choice. It has a good balance of ease-of-use and features, at least for me. It's also faster on my system than Eclipse was, but seems to have the same general feature-set. I had a bunch of trouble getting the build process working, same with Eclipse. I don't know Ant, and I didn't invest the time to learn it. I was able to work around the problem by symlinking my ~/NetBeansProject/projectName/build/web directory to $CATALINA_HOME/webapps/projectName. Yes, that's a hack, but it works pretty well.
NetBeans had all the features I listed above, including integration with CVS and SVN and comprehensive documentation.. plus, I actually got the build process to work for me. Overall it's a good IDE, it has code completion (which I don't care for, nor use), decent default fonts and colors, etc. I can't complain. If you haven't tried it, it's worth a look.
Anyways, that's my little review, if anyone actually reads this blog, let me know if there are any other editors/IDEs I should try. I left out commercial editors since I can't afford the $100-500 that they average. That being said, I hear that IntelliJ IDEA is amazing and completely worth the $250. Maybe one day, if I land a job doing full-time Java programming I'll give it a look. Until now, it's FOSS for me.