What's the best Java IDE?
July 30, 2005 7:59 AM   Subscribe

I'm learning Java. Which IDE should I use?

I will be mainly working from Win XP computers, and my most extensive programming experience (and not much at that) is with VBA, which comes with its own IDE. I'll be glad to answer any questions about the context. I may also be doing some Perl in the future, if that makes any difference.

(Also, I've found a lot of nice online tutorials, but am taking recommendations for books/websites/other resources.
posted by bingo to Computers & Internet (33 answers total) 1 user marked this as a favorite
You're learning Java from scratch, have no significant programming experience, and are using Windows. Therefore I strongly suggest your very first IDE be: notepad.exe and javac.

After you've learned the basics of the language and are confident with defining classes and assembling them into applications, you might want to try Eclipse or Netbeans, but you really, really should learn the language without a bunch of IDE crap in the way, first.

My personal favorite of all the IDEs is Together ControlCenter (or whatever Borland is calling it now that they own the thing) but it's expensive and depends heavily on your ability to work with UML.
posted by majick at 8:18 AM on July 30, 2005

Eclipse or jEdit are both quite good. jEdit starts off as a text editor, but gains its IDE features through the use of its extensive plugin architecture. Eclipse is the 800 lb. gorilla of java IDEs, has (or had, it's been a while since I've used it) big support from IBM. jEdit's my editor of choice since it's pretty lightweight, and its plugins have essential functions for html that I use on a regular basis. And after previewing, they're both open source products, so you won't have to worry about wasting money.
posted by boo_radley at 8:37 AM on July 30, 2005

jEdit and Ant.

Use jEdit as your editor, and Ant as your build tool. Once you've mastered those, you'll be a Java god.

Get used to the command-line. If you're working in an environment where Perl is used, an inability to use the command-line with confidence will inevitably result in you eating lunch at the 'special' kids' table.

Oh, yeah: Perl is sh*te, but if you're going to be doing anything with it, the O'Reilly books (all the blue spines) are absolutely invaluable. I sometimes regret giving up on Perl, just because of the o'Reilly books.
posted by veedubya at 8:43 AM on July 30, 2005

There are three camps. The first camp, and the one that all beginners should subscribe to is the plain old text editor of your choice. You need to learn the basics without being encumbered by the IDE.

The second camp is those that use open source tools, in that respect few will argue that there is a better IDE than Eclipse. It was originally open sourced by IBM as part of their Websphere Application Developer suite, and now they base their suite on the progress of Eclipse instead. Our own Pookzilla is an IBM developer who works fulltime on developing Eclipse.

The third camp are proprietary IDEs, of which there are many. Most who've tried them all out will agree that there is probably no better IDE out there than IntelliJ's IDEA, which is just plain awesome. However, it's refactoring powers and live templates are of no use to someone just learning how to write Java code, and the $400 price tag is probably the most major stumbling block. (I can attest that at my last job, when we switched from JDeveloper to IDEA that productivity went up by at least 20% in our dev team, no shittin' ya).
posted by furtive at 8:45 AM on July 30, 2005

if your previous programming experience has been with an idea, i'd suggest eclipse. it's free and widely used, so you will be using something at least vaguely similar to what you used before, it won't cost you anything, and you should be able to find support while learning.
posted by andrew cooke at 8:49 AM on July 30, 2005

I'm with majick on this. You really need to start with just a plain text editor and learn the language reasonably well before worrying about IDEs.
posted by Nick Jordan at 9:16 AM on July 30, 2005

andrew cooke, I'm starting to believe that we're the same person. Why are we never seen in the same room together?
posted by veedubya at 9:36 AM on July 30, 2005

Fourthing the "use a text editor to learn the language, THEN move to using an IDE" advice.

However, I'd say to get a programmer's text editor that can syntax highlight and auto-tab, instead of using Notepad, as trying to edit code without those two features is just painful. I don't use Windows so I cannot recommend any personally, but I hear TextPad (I think) is nice, or CrimsonEditor.
posted by cyrusdogstar at 9:44 AM on July 30, 2005

furtive nails it on the three camps. You'll definitely want to avoid spending the dough right away. The power of IDEA will be totally lost on you. I've always subscribed to the text editor + Ant approach for beginners. I'm coming around to think that a good free IDE like Eclipse might be a better approach these days. With that said, I still think that learning Ant as you go along is a very wise move. If you haven't figured it out, Ant is the build tool that 99% of open source Java projects use. Learning to automate your development tasks will make you a better programmer and keeps you from becoming a slave to your IDE.

As for resources, Thinking in Java is still the gold standard in learning the language in depth. Read the book, do all the chapter-end exercises and you will learn the how and why of the language in tremendous depth. The best part is the book is available for free online. A word of caution, it is a big book and really only teaches the language and some of the built in libraries. You will have to supplement this book with others to cover the area that you want to do development in (e.g. web, gui apps, etc.).
posted by mmascolino at 9:49 AM on July 30, 2005

However, I'd say to get a programmer's text editor that can syntax highlight and auto-tab, instead of using Notepad, as trying to edit code without those two features is just painful.

I'm interested in hearing more about this from those in the 'learn in Notepad' camp. What's the harm of using a tool that will color-code and indent for me? Won't that help me learn the correct format? I suppose the most obvious argument is that I should learn to parse the code mentally without that help, but...won't there always be an IDE available if I need one? And won't seeing the proper indentation and color coding thousands of times help me to see the structure of what I'm doing so that I can more easily recreate it properly without those tools if I need to?

Excuse my obvious and admitted ignorance. Just asking.
posted by bingo at 10:28 AM on July 30, 2005

bingo: Part of the problem with using an IDE when you start is that to do basic tasks, you generally must use the software's dialogues. For instance, I use Eclipse as my IDE of choice. In order to define a class, and have it integrate correctly with the build process, you *must* go through the dialogue that creates a new class.

Also, if you're just doing a hundred toy problems so that you can learn the language, you're going to have the vast annoyance of having to start a new project for each one. Depending on your IDE, this might prove very annoying.

Basically, using an IDE from the get-go is likely to weigh you down with a lot of "book keeping", which gets in the way of exploratory programming.

I agree with the general sentiment of the notepad+javac folks. However, I also agree that you should have font colorization and indentation. It *does* make life much, much easier, especially when you're just starting out.

I'm a unix boy, so I have easy access to my favorite editor, Emacs. I learned to program in it. However, the Windows port of it is inelegant, and if you've never used it before, it's almost as much of an ordeal to learn as a full-fledged IDE (although in a different way).

I suggest TextPad in Windows. It will even handle compilation and running for you, IIRC. It has font-lock-mode text colorization and automagical idententation.

When you're comfortable with the language, I suggest Eclipse. NetBeans doesn't suck, in and of itself, but its interface to the filesystem is painful at best, it runs slowly and crapily on my system, and I find that sometimes the syntax checking system flips out. I use both of them, but for different things: Eclipse is where I write my code, while I use NetBeans for DnD interface building.
posted by Netzapper at 10:43 AM on July 30, 2005

While I have respect for the "start with notepad/jEdit" camp, I'd recommend not staying there for two long. Java is an extremely verbose language, and simple things (like iterating across a collection) can be really annoying. My guess is you're going to get frustated with lots of menial tasks. When that feeling sets in, switch to Eclipse and don't look back.

It takes care of tons of stuff you'll get annoyed with really quickly, like importing classes, writing getters/setters, refactoring code, extracting interfaces, casting objects coming out of collections, etc etc. Eclipse is the only reason I enjoy writing Java. If I had to do it all by hand, I'd have stopped a long time ago. So don't punish yourself. You'll learn more starting that way, and it will help you appreciate Eclipse more, but don't let it become a cross you have to bear.

And when you switch to Eclipse, the two keystrokes you should learn first are ctrl-. (move to next error) ctrl-1 (auto-fix error). It's awesome. Good luck!
posted by heresiarch at 10:51 AM on July 30, 2005

i think really it's just a "lifestyle choice" (ide or text editor). some of us, err, more mature people started with text editors and feel that everyone should know what the ide is "doing for us", but i'm not sure it helps. i've only started using eclipse recently and find that knowing too much is dangerous. i get frustrated with the eclipse way, do a quick command line hack, and then find that i've broken something as a result, or that i've missed a cool eclipse feature.

one day, eventually, perhaps, you should understand what eclipse is doing. just as you should understand what mark and sweep garbage collection is, say. but, i suspect, no more than that.

of course, you can also start by learning the details. there's nothing wrong with using a simple editor (or even a not-so simple one like emacs), but if you're learning a new language, why also choose to learn a new kind of tool?

veedubya - maybe because we're on opposite sides of the world? (and shouldn't you be asleep or something? ;o)
posted by andrew cooke at 10:59 AM on July 30, 2005

I learned on NotePad and the command line. I tell new Java programmers to try jEdit first for the basic points bingo makes. jEdit can be as easy to use as a standard text editor and color coding and indenting can help you spot errors quicker. And I agree with heresiarch, once you get off the ground, learn to extend jEdit or pick a more robust IDE.
posted by McGuillicuddy at 11:18 AM on July 30, 2005

I taught an introduction to Java class earlier in the summer, and we used DrJava. It's a "learning IDE" designed for beginners, but I find myself using it quite often.

It's a very lightweight IDE, without code completion and all of the project management stuff. What is especially neat about it is an interpreter that allows you to execute Java statements one at a time (i.e. without creating a class and a main method, etc.) and see the result instantly.

I highly recommend giving it a try. It's definitely different than most of the other tools you'll see out there. Note that there's also a DrJava plugin for Eclipse, if you decide to go down that path, although I wouldn't reccomend Eclipse for someone just starting out.
posted by shaun at 11:38 AM on July 30, 2005

what majick said.
posted by neilkod at 12:16 PM on July 30, 2005

Try jcreator. It's the best java editor I've seen. Fun to use, fast, clean, newer version supports Ant. They have both a free and trial version.
posted by null terminated at 1:03 PM on July 30, 2005

You're learning Java from scratch, have no significant programming experience, and are using Windows. Therefore I strongly suggest your very first IDE be: notepad.exe and javac.

I totaly agree. Java is actualy very dependant on the locations of files, etc. And you'll want to understand how the whole CLASSPATH thing works. The best way to do that is with a text editor (I actualy started java programming with MSDOS edit back in the day, since you could have multiple files open, unlike notepad :P)

But a tool that does color coding and code completion is helpfull. I sometimes use JBuilder to edit while still compiling and running from the command line.

I also agree with everyone who recommends eclipse. I'm stuck with Jbuilder because eclipse does code completion just slightly diffrently and it drives me nuts! But eclipse (and new versions of it) will always be free
posted by delmoi at 2:09 PM on July 30, 2005

I'm going to cheat a little and ask about a related error while all you java people are here paying attention:

"Error: cannot access java.lang.Object
bad class file: C:\Program Files\Java\jre1.5.0_04\lib\rt.jar(java/lang/Object.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath."

I have found a number of forum discussions by googling, but so far nothing that I understand well enough to try implementing it. I am all for figuring out problems by myself, but this strikes me as the kind of thing that it's ok to ask more experienced people for help with.

I should mention that this error occurred within an IDE. When compile with javac on the command line, I don't get this error.
posted by bingo at 2:13 PM on July 30, 2005

...and maybe that's an argument for using Notepad.
posted by bingo at 2:14 PM on July 30, 2005

looks like you're trying to use class files compiled with java 5 with an earlier version of java. check that the java compiler the IDE is using is below C:\Program Files\Java\jre1.5.0_04

it's explained in more detail here
posted by andrew cooke at 3:08 PM on July 30, 2005

sorry, reading the link i gave myself, it seems that the problem is most likely that when you run something you've compiled, you're using an old (1.4) version of java (i thought your error was one on compilation, but it looks like it happens when you try to execute the compiled code).

so "java" at your command line is 1.4, but "java" in the ide is 1.5.

what does "java -version" say? if it doesn't say 1.5 that's your problem.
posted by andrew cooke at 3:12 PM on July 30, 2005

It says 1.5.0_04-b05.
posted by bingo at 3:29 PM on July 30, 2005

oh. so exactly when does the error occur?
posted by andrew cooke at 3:43 PM on July 30, 2005

When I'm trying to compile my 'hello world' program in the IDE. The same program compiled fine with Notepad and javac on the command line.
posted by bingo at 3:47 PM on July 30, 2005

ok, so it looks like the compiler in your ide is 1.4, but it's using 1.5 classes from somewhere. you need to tall your ide to use the same java you are using. it probably came with an old java version (1.5 is pretty new). somewhere there will be an option that tells your ide what java compiler (javac) to use - it should point to the one at C:\Program Files\Java\jre1.5.0_04
posted by andrew cooke at 4:05 PM on July 30, 2005

But the SDK I downloaded from Sun is at C:\j2sdk1.4.2_08. Did I put it in the wrong place? I thought it didn't matter as long as I added it to the path (which I did).

The IDE in question is DrJava (as recommended by shaun...don't be offended, anyone, I'm going to have a look at every suggestion, this is just the one I tried first), and I looked through the config menus but I don't see a way to change the directory where it looks for the compiler. There is a place to tell it where to look for tools.jar, and I gave it C:\j2sdk1.4.2_08\lib\tools.jar.
posted by bingo at 4:38 PM on July 30, 2005

you have two different javas on your machine. at C:\Program Files\Java\jre1.5.0_04 you have the 1.5 runtime. you probably downloaded that some time back (or it was installed by another program). from the directory name it's just the jre (the "runtime"). the jre is enough to run java programs, but not enough to compile them.

the java you downloaded from sun is version 1.4, and that's the full development kit (what you need to compile java programs as well as run them).

you're on windows? one simple solution to this would be to uninstall that one (1.4, via control panel) and download/install the 1.5 development kit. you can get it from here (follow the link in the JDK section).

otherwise, you need to look at why the ide is getting confused. you probably have CLASSPATH or JAVA_HOME or something similar defined somewhere (system properties?) that refers to the 1.5 version java, and that's confusing the ide.

sorry, it shouldn't be this hard!
posted by andrew cooke at 5:46 PM on July 30, 2005

if that wasn't clear - you want everything using the same version of java. at the moment you have two versions and they are getting mixed up in the ide.

so you either need to work out why the ide is confused, or just make sure your machine only has one version present.

and, to make things more complicated, that version has to be the full development kit. the jre alone isn't enough to develop code.

but there should be no problems installing the 1.5 development kit (jdk) in parallel with the 1.5 jre you already have. they should be able to live together. i hope.
posted by andrew cooke at 5:50 PM on July 30, 2005

bingo: Simple solution: Uninstall everything and then reinstall your IDE and JDK. I'd say to install the JDK first, and make sure to get the latest versions.
posted by delmoi at 6:46 PM on July 30, 2005

Hehe, the derail in this thread is the exact reason why people should start with a text editor. Of course I didn't specify which one they should start with because everyone has their favourite, but at a minimum it should have some syntax highlighting and allow for multiple buffers (I'm a big SciTe fan myself but I also recommend UltraEdit or Vim).
posted by furtive at 6:53 PM on July 30, 2005

hope you got that sorted. i'm off to bed.

furtive - having two different versions installed is a recipe for disaster however you work. it's easy to think of counter examples where an ide would have looked better (netbeans downloads with the jdk, so would no doubt have worked fine; at some point he would have had problems at the command line). yet people invariably think that the way they are used to doing things is best. shrug.
posted by andrew cooke at 8:06 PM on July 30, 2005

I reinstalled everything, but DrJava doesn't like the new tools.jar file, so I think I'm going to forget DrJava from now and use the command line while trying out various suggestions above. And I have already started reading Thinking In Java on mmasculino's rec. Thanks to all who have answered.
posted by bingo at 9:00 PM on July 30, 2005

« Older Good Italian Sunday Sauce Recipe?   |   A short story where sex and conversation switch... Newer »
This thread is closed to new comments.