Refactoring without eclipse - java

I am currently working on a source tree with hundreds of java modules that reference eachother. I can't want to import them all into Eclipse because it becomes very confusing and slow. Are there any stand alone linux tools that can help me refactor code? If not, how can I go about doing this effectively without Eclipse?
** Edit I would like a tool that someone has used. I realize there are a lot of tools out there that may or may not work. I was hoping SO could help me by narrowing the list.
**Edit I appreciate the help but I don't really want to justify not using Eclipse for this operation. I already use it to edit 20 or so of these modules at a time. I can't keep the amount of source I want to in the workspace effectively.

A quick google search returned RefactorIT. That's as good as place as any to start.
I am also curious how Eclipse would make it more confusing. I can't imagine that manually organizing code would be less confusing than having Eclipse's project explorer, for example.

Related

How to start out hand coding Java

I've just started with Java and I have been using Netbeans. I have tried Eclipse but it kept crashing on me and I gave up. Since then I have produced a small application, but I find that I feel very restricted within the development environment, and I see lots of generated code that I really don't understand, and which seems to bear little resemblance to any code I may find while researching a problem.
With this in mind, and having seen many suggestions, I would rather begin to code by hand so that I understand exactly what is going where, and why.
My question(s):
I have seen and read through a great many tutorials but most of them assume a certain level of competency. I've built a small desktop editor in Netbeans, but I've never coded Java by hand. With that in mind could you suggest a good "getting starting" tutorial for me?
I would also like some advice on a coding environment. I will be creating desktop applications and am already familiar with Geany through coding in Python, but I've seen very little information about Geany and Java.
I'd appreciate any suggestions about this, because there seem to be a great many editors available, but please note that I am using Ubuntu on my development machine. Open source is not a requirement, but being free is.
BTW, I have no problems with trying Eclipse again if that seems to be the general consensus, I am currently just a little jaded on it since I have never successfully even tested anything without a cataclysmic crash.
Many thanks for any advice that you can give.
MVK
A Little Update
Many thanks to those of you who have taken the time to give an answer. I am currently playing about with the Sublime editor, suggested by user1432824, having had another try at Eclipse. Unfortunately though, Eclipse has a habit of crashing when saving files which is rather inconvenient. I plan to chase this up and see if there is a fixable reason, but it still feels a little heavyweight and integrated and I really want to move away from that if possible.
Thanks for the tutorial links, I've seen most of them already in my travels, but I'm happy to get more.
Finally
Many thanks for your input, I think that I have come to a comfortable result, with a few loose ends that Ill check on later. Here are my findings so far:
The Sublime Editor:
This was a tricky one. The Sublime editor is actually an excellent little app (despite how it looks out of the box!) and I have little doubt that I will use it at some point, but for now it lacks something for me, although I would be hard pressed to explain exactly what. Thanks for the suggestion though, its always good to find new editors.
Eclipse:
So I took the plunge and tried Eclipse again, and, just like the first time I used it I've been rather impressed with the overall look and feel of it, however, just like the last time it crashes at the most inopportune moments and despite much searching I have yet to discover the reason or the cure, which leaves Eclipse out of the running. Besides, although I like the feel of Eclipse it is still a bit on the heavyweight side for what I want to do.
BlueJ:
I admit that I did not try this program, although thanks for the suggestion. It seems to me like just another IDE and I really want to move away from the whole IDE thing for a while, at least until I understand a little more about how Java actually works.
Many thanks for your suggestions, but I think for now that I will go with Geany for a few reasons: As a very lightweight editor it can compile and run Java from the menu or keyboard, which just saves some time, and I have become addicted to the Snippets function which comes in handy once you have learned the basic syntax of whatever commands you add to it.
The only other choice now is between ANT and Maven and I think that the only way to decide between the two is to use both and see which one 'feels' better to me.
Many thanks to all who responded and my final question must be: Since you have all helped me reach my final decision, how to I go about accepting this question? Any advice on that front would also be helpful!
regards,
MVK
In my opinion, if you are new to Java, don't start with GUI. Start with simple text application. The best resource for beginners in my opinion is the official Java tutorial.
http://docs.oracle.com/javase/tutorial/
Good luck!
Have you looked at BlueJ ? From the website:
BlueJ is an integrated Java environment specifically designed for
introductory teaching.
BlueJ was developed at a University specifically for the purpose of
teaching object orientation with Java.
BlueJ is free!
I would strongly recommend using some form of IDE. It'll provide interactive debugging, hints, completion, code colourisation and useful error highlighting.
have you tried the Java online trainings?
http://java.sun.com/developer/onlineTraining/awt/contents.html
As for editors, I started out with a simple plain text editor like those that come on Mac and Windows. I also use Eclipse for Java Developers, and Sublime Text. Sublime has a free, unlimited trial, but will bug you every few saves to buy the premium version.
I would recommend that you get familiar with a build tool, like Ant or Maven. Once you have a project with more than 1 class in it, using a variety of libraries, it's good to have some help managing dependencies, running tests, building jars, etc.

Which part I have to know to write eclipse's plugin for analyse Java source code?

I want to write some plugin to analysis Java source code. Which part of eclipse's plugin I have to know? I know this is a stupid question, but I really don't know where I have to start and I don't have too much time. I am not an actual programmer, I am a computer repair technician. So I just can write plugin (I love it) in spare time.
I am really grateful if someone give me a few pointers.
I didn't mean to be snarky above. So, I'd first recommend getting to understand the Eclipse architecture, plugin model and APIs. Here is an old, but still relevant tutorial:
http://eclipsepluginsite.com/#
It doesn't go into JDT at all, but does give you an idea about Eclipse plugins in general. So, once you understand that tutorial, you can move on to JDT:
http://www.vogella.com/articles/EclipseJDT/article.html
You'll need to master quite a lot -- the Builder API to hook into the incremental build process and get notified when files change, the IResource type hierarchy to get to the source files, the Java AST classes (there's a big bunch of those), some quirks concerning type bindings, etc. There is no simple pointer to give.

Understanding and modifying large projects

I am a novice programmer and as a part of my project I have to modify a open source tool (written in java) which has hundreds of classes. I have to modify a significant part of it to suit the needs of the project. I have been struggling with it for the last one month trying to read code, trying to find out the functionalities of each class and trying to figure out the pipeline from start to end.
80% of the classes have incomplete/missing documentation. The remaining 20% are those that form the general purpose API for the tool.
One month of code reading has just helped me understand the basic architecture. But I have not been able to figure out the exact changes I need to make for my project. One time, I started modifying a part of the code and soon made so many changes that I could no longer remember.
A friend suggested that I try to write down the class hierarchy. Is there a better(standard?) way to do this?
check in the code in some source code repository (Subversion, CVS, Git, Mercurial...)
make sure that you can build the project from the source and run it
if you already have an application that uses this open source tool try removing the binary dependency and introduce project dependency in eclipse or any other IDE. run your code and step through the code that you want to understand
after every small change commit
if you have different ideas branch the code
There's a great book called Working Effectively with Legacy Code, by Michael Feathers. There's a shorter article version here.
One of his points is that the best thing you can do is write unit tests for the existing code. This helps you understand where the entry points are and how the code should work. Then it lets you refactor it without worrying that you're going to break it.
From the article linked, the summary of his strategy:
1. Identify change points
2. Find an inflection point
3. Cover the inflection point
a. Break external dependencies
b. Break internal dependencies
c. Write tests
4. Make changes
5. Refactor the covered code.
Two things that Eclipse (and other IDEs as well) offer to 'fight' this. I've used them on very large projects:
Call hierarchy - right-click a method and choose "call hierarchy", or use CTRL + ALT + H. This gives you all methods that call the selected method, with option to check further down the tree. This feature is really very useful.
Type hierarchy - see the inheritance hierarchy of classes. In eclipse it's F4 or CTRL + T.
Also:
find a way to make so that changes take effect on-save, and you don't have to redeploy
use a debugger - run in debug mode, within the IDE, so that you see how the flow proceeds
My friend, you are in deep doodoo. Modifying large, badly documented legacy code is one of those projects that makes experienced programmers seriously contemplate the joys of selling insurance, or some other alternative career. However it isn't impossible, and here are some tips that I hope will help.
Your first task is to understand the code as much as possible. You are at least on the right track there. Getting a good idea of the class structure is absolutely important, and a diagram is probably the best way. The other thing I would suggest is that when you find out what a class does, add the missing documentation yourself. That way when you come back to it you wont' have forgotten what you found out.
Don't forget the debugger. If you want to find out what is really going on, stepping through the relevant code, or simply finding out what a call stack really looks like at a certain point can be very helpful.
The only way to understand code is to read it. Keep working that is my advice.
There are projects with better documentation than others. Here is a couple of projects that I know are well organized:
Tomcat ,
Jetty,
Hudson,
You should check java-source for more open source projects.
Personally I think it is very difficult to try to understand an entire application all at once. Instead, try to focus only on certain modules. For example, if you can identify a module that you need to change (e.g. based on a screen, or certain input/output point), then start by making one small change and testing it. Go from there, making a small change, testing, and moving on.
Additionally, if your project has unit tests (consider yourself lucky) and review the unit tests of the module you are focusing on. That will help you get an idea of what the module is expected to do.
In my opinion there is no standard approach to understand a project. It depends on many factors, from the understandability of the code/architecture you're analyzing to your previous experience on large projects.
I suggest you to reverse-engineer the code by using a modeling tool, so that you can generate some UML models from the existing source code. These diagrams can be helpful as a graphic guideline during your anaysis of the code.
Don't be afraid to use debugging to grab the logic of the most complex functionalities of the project. Running the most complex code instruction by instruction, seeing the exact values of the variables and the interactions between the objects can be helpful.
Before you refactor to change the project to suit your needs, be sure to write some test cases, so that you can verify that your modifications don't break the code in unexpected ways.
Here are a couple recommendations
Get the code into some form of CVS.
This way if you start making changes
you can always look back at previous
versions.
Take the time to document what you
have already learned/gone through. Javadoc is fine
for this.
Create a UML structure for you code.
There are lots of plugins out there and wil give you a nice representation of your code layout.

Is Eclipse the best IDE for Java? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Is Eclipse the best IDE for Java?
If not, is there something better?
I want to know and possibly try it out. Thanks.
Let me just start out by saying that Eclipse is a fantastic IDE for Java and many other languages. Its plugin architecture and its extensibility are hard to rival and the fact that it's free is a huge plus for smaller teams or tight budgets.
A few things that I hate about Eclipse.
The documentation is really lacking. I don't know who writes the stuff, but if it's not just flatly missing, it's incomplete. If it's not incomplete, then it's just flat out wrong. I have wasted many precious hours trying to use a given feature in Eclipse by walking through its documentation only to discover that it was all trash to begin with.
Despite the size of the project, I have found the community to be very lacking and/or confusing enough to be hard to participate in. I have tried several times to get help on a particular subject or plugin only to be sent to 3 or 4 different newsgroups who all point to the other newsgroup or just plain don't respond. This can be very frustrating, as much smaller open source products that I use are really good about answering questions I have. Perhaps it's simply a function of the size of the community.
If you need functionality beyond the bundled functionality of one of their distros (for instance, the Eclipse for Java EE Developers distro which bundles things like the WTP), I have found the installation process for extra plugins excruciatingly painful. I don't know why they can't make that process simpler (or maybe I'm just spoiled on my Mac at home and don't know how bad it really is out in the 'real' world) but if I'm not just unsuccessful, oftentimes it's a process of multiple hours to get a new plugin installed. This was supposedly one of their goals in 3.4 (to make installation of new projects simpler); if they succeeded, I can't tell.
Documentation in the form of books and actual tutorials is sorely lacking. I want a master walkthrough for something as dense and feature-rich as Eclipse; something that says, 'hey, did you know about this feature and how it can really make you more productive?'. As far as I've found, nothing like that exists. If you want to figure out Eclipse, you've got one option, sit down and play with it (literally play with it, not just see a feature and go and read the documentation for it, because that probably doesn't exist or is wrong).
Despite these things, Eclipse really is a great IDE. Its refactoring tooling works tremendously well. The handling of Javadoc works perfectly. All of features we've come to expect of an IDE are their (code completion, templates, integration with various SCMSs, integration with build systems). Its code formatting and cleanup tools are very powerful. I find its build system to work well and intuitively. I think these are the things upon which its reputation is really built.
I don't have enough experience with other IDEs or with other distros of Eclipse (I've seen RAD at work quite a few times; I can't believe anyone would pay what they're charging for that) to comment on them, but I've been quite happy with Eclipse for the most part. One tip I have heard from multiple places is that if you want Eclipse without a lot of the hassle that can come with its straight install, go with a for-pay distro of it. My Eclipse is a highly recommended version that I've seen all over the net that is really very affordable (last I heard, $50 for the distro plus a year of free upgrades). If you have the budget and need the added functionality, I'd go with something like that.
Anyway, I've tried to be as detailed as I can. I hope this helps and good luck on your search! :)
IntelliJ IDEA was awsome. Now it is just "better than Eclipse". You can code in IDEA several times faster than in Eclipse in my experience (I moved from being an Eclipse early-adopter to IDEA and haven't looked back) but IDEA has a number of flaws:
Full version is not free.
It hogs memory
Project management is not great
Jetbrains keep bringing out minor
enhancements and calling them major
releases. IDEA is now slower and
buggier than it was a few years ago.
And you get charged for the
pleasure! (IDEA now has a free Community Edition)
I still wouldn't go back though; the code refactorings and intentions in IDEA are just too good.
A major version of Eclipse came out a while back and it took me about an hour of searching on the website to figure out what was actually contained in the release which might persuade me back into the fold. Visit JetBrains to see how to sell an IDE!
There is no best IDE. You make it as good as you get used using it.
Eclipse can't remotely be called an IDE to my opinion. Okay that's exaggerated, I know. It merely reflects my intense agony thanks to eclipse! Whatever you do, it just doesn't work! You always need to fight with it to make it do things the right way. During that time, you're not developing code which is what you're supposed to do, right? eclipse and maven integration: unreliable! Eclipse and ivy integration: unreliable. WTP: buggy buggy buggy! Eclipse and wstl validation: buggy! It complains about not finding URL's out of the blue even though they do exist, and a few days later, without having changed them, it suddenly does find them etc etc. I Could write a frakking book about it. To answer your question: NO ECLIPSE IS NOT EVEN CLOSE THE BEST IDE!!! IntelliJ is supposed to be MUCH better!
Eclipse was the first IDE to move me off of XEmacs. However, when my employer offered to buy me a Intellij IDEA license if I wanted one it only took 3 days with an evaluation copy to convince me to go for it.
It seems like so many small things are just nicer.
IntelliJ is good one but its not free!!Then NetBeans is also a good option.Also if you are IBM suite WSAD is good
I'd have to vote for Netbeans as the best one currently. Eclipse is decent, but right now Netbeans is better.
I used IntelliJ for almost 5+ years (from v1.5 to v7) and around 8 months ago I migrated to IBM RAD (which is built on top of old eclipse platform) and around 3 months ago I settled down with Eclipse (Ganymede).
I used IntelliJ on a mid size projects (with 10k classes) and I'm using Eclipse on one with just few hundreds of classes.
I found both of these IDEs (IntelliJ and Eclipse) to be good. IBM RAD is just a waste of money (ofcourse one could be stuck in an IBM shop without choice).
IntelliJ has far superior refactoring capabilities and keyboard shortcuts for most of the features compared to Eclipse. It supports importing projects from Eclipse. It has better built in xml handling capabilities (with refactorings applicable almost like for the java code). Built in Intelli Sense is also very good.
Eclipse is a great tool and its free. It took me around 1-2 months to get used to Eclipse from IntelliJ (lot of unlearning of shortcuts), but I got hang of Eclipse, it has been pretty smooth. I havent used Eclipse on mid size project.
Both IntelliJ and Eclipse have active plugin communities and both integrate well with version control systems, unit test frameworks, application servers and profilers.
IntelliJ started becoming slow and bloated starting from v4.0. It was slow with mid size projects. I would not use IntelliJ unless its performance can be improved.
I havent used these two IDEs for anything other than java development.
If you are a java developer and your company pays for IntelliJ and if your project is not too big, go for it. Otherwise, dont despair: Eclipse is always there.
I gave Eclipse a 3 months ride at my new work, but after that I found out that normal Maven project can be run in IntelliJ IDEA too (unless it's Eclipse plugin/EMF/something of course ;-)). 3 months are not enough to compare it with 8+ years with IDEA, but it's enough to claim I gave it a fair try. I decided to live with its perspectives (other IDEs don't need them), with its poor debugger (doesn't show date values unless you click on them! etc.), with its comparatively worse completion than IDEA has.
Now after all those years IDEA is also free (community edition) and I use it without much trouble. Of course I miss some of those "Ultimate" features of paid version, but it's far better than Eclipse. Biggest difference is the whole mindset needed for both of these IDEs. But after you master the mindset of either I can't understand what can anyone hold to Eclipse - unless you need its plugin ecosystem or you have some serious investments there.
Example of "mindset" differences: You have to save in Eclipse, not in IDEA, and I don't care what is better or worse - but you have to save in Eclipse to let him clean up underlined errors that are not errors anymore, etc. ;-) You have to save there in order to get rid of errors in other files too, because other file doesn't see the changes otherwise.
I blogged much more about this topic - and yes, I'm biased, though I tried to be as little as possible. But after some time it wasn't simply possible: :-)
http://virgo47.wordpress.com/2011/01/30/eclipse-vs-intellij-idea/
http://virgo47.wordpress.com/2011/02/22/from-intellij-idea-to-eclipse-2/
http://virgo47.wordpress.com/2011/03/24/from-intellij-idea-to-eclipse-3/
http://virgo47.wordpress.com/2011/04/10/from-intellij-idea-to-eclipse-4/
And no, not even IDEA is perfect, I know it. Because I use it a lot. But it is the best Java IDE if you ask me. Even the Community edition.
[This is not really an answer, just an anecdote. I worked with guys who used emacs heavily loaded with macros and color coded. Crazy! Why do that when there are so many good IDEs out there?]
if you know you way around emacs you can code 100x faster then an IDE. And it can handle bunch of diffrent languages so you do not need to change your coding enviroment if you need to code in another language. Works on all operating systems, you can custimize/add anything you want. Even edit files half way across the world over ssh.(no downloading or uploading).
Before calling them crazy you gotto use it first. i am sure they are calling you crazy for using an IDE :).
It is often said that there are better IDE's for various languages (eg Java) than Eclipse.
The power of Eclipse is that it's basically the same IDE for many languages, meaning that if you know you'll have to code in several programming languages (Java, C++, Python) it's a huge advantage that you only have to learn one IDE: Eclipse.
Eclipse! It can be slow at times and uses a lot of memory but it works well.
I don't know if Eclipse is THE BEST Java IDE, but it is definitely very decent and my favorite IDE. I tried IntelliJ briefly before, and found that it's pretty similar to Eclipse (IntelliJ might offer some nicer features, but Eclipse is free and open source).
I never really tried NetBean because I know Eclipse before I know NetBean.
Eclipse is my favorite because:
Free
Extensible (to a point that you can turn it in to C++ IDE or DB Development IDE)
Open source
I know how to write Eclipse plugin
You can develop a product easily with Eclipse (exp. Lime Wire is Eclipse under the hood)
If you are used to using conventional Java IDE like JCreator you might need some time to get used to Eclipse. I remember when I first learned Eclipse, I didn't know how to compile Java source...
I would suggest that in order to find the best IDE FOR YOU, try what people recommended (NetBean, Eclipse, and IntelliJ), and see which one you like the most, then stick with it and become an expert of it. Having the right IDE will boost up your productivity a lot in my opinion.
I am going to have to recommend Oracle JDeveloper. I personally thought that Eclipse was the best Java IDE too at one point. Then I was introduced to Oracle JDeveloper by my job. I find the UI design much better than Eclipse. Also it comes with an incredible amount of features built in including great support for EJB3, JSF, WebServices, etc. It is essentially an IDE for the entire JavaEE stack (and the Oracle ADF framework as well). - All of the tools you will (probably) need for JavaEE development come with this IDE right out of the box, no plugins required (unless you download the minimalist version).
Talking about java Ide it is better to go for NetBeans.In My opinion it is better and provide great advantage over other ide but it has disadvantage over Eclipse that it grabs more more while working but do to its features and support i suggest Netbeans than any ide
Agreeing with the others. Netbeans is a pretty good IDE which also caters for other languages (PHP, Ruby, C/C++) if you're prone to using any of those. Then you get the added benefit of knowing your way around the IDE when deciding to pick up a new language.
To be fair however, I haven't had much time with the eclipse IDE.
This is subjective... I find it to be a good tool.
It depends what kind of development you're doing - for EJB stuff, many folk would favour Netbeans. It also depends how much you want to spend - I assume you're talking about free IDEs?
In my opinion if you got the resources to use, then go with eclipse. NetBeans which is awesome like eclipse is another best option, these are the only 2 I've ever used (loved, needed, wanted)
Eclipse is hands down the most popular, and for good reason!
Hope this helps.
I'd agree with some of the others out there saying that NetBeans and IntelliJ are both good IDEs. And I'd say that in using all three (Eclipse + other two), that Eclipse is by far my favorite. I found some of the documentation out-dated, but also found the support community very helpful. I started using Eclipse by jumping into the deep end of the pool: writing an RCP before ever learning the IDE. The IDE was intuitive to use, and when I found the right news groups to post to - most of my questions were already answered. The hardest thing for me (and frustrating, admittedly) was knowing how to phrase my search terms in order to get to the answer that was already posted.
Remember that Eclipse is still "relatively new" as an IDE player, though given that - it's pretty darn robust.
My only complaint about Eclipse is that with each new release, it seems to hog up more resources. With a mid-sized project/workspace, it takes seemingly forever to build (or rebuild) the project. Compared to IntelliJ, it's faster and more intuitive to use.
Don't forget that Eclipse Platform was started by IBM. There are few platforms out there.
IBM Websphere Application Developer
(WSAD) and/or Rational Application
Developer (RAD) which is a
Eclipse-type IDE from IBM (actually,
that's Eclipse with IBM specialized
libraries/plugins).
MyEclipse (never used it but it's another Eclipse-type IDE)
Sun Microsystem's
NetBeans. It's too Java-centric as
it's designed to create applications
purely in java (NetBeans runs in
Java).
IntelliJ (to name but a few)
Oracle JDeveloper (I never really liked the directory structure layout JDeveloper creates).
The advantage with Eclipse is that it can be customized to your development pleasure, plugins can be written for Eclipse to conform to your needs (e.g. The Eclipse "Easy Explorer" plugin for browsing the directory of your source in Windows Explorer).
Eclipse allows you to also incorporate other languages/SDK's, such as C++, Silverlight projects, Android Projects for development. You can also easily manage resources in Eclipse.
In my experience NetBeans are resource intensive. Oracle JDeveloper and IntelliJ aren't free though.
Oh yes, If you have issues or bugs with Eclipse, Eclipse has the ability to restart and submit the crash to Eclipse servers.
This is not really an answer, just an anecdote. I worked with guys who used emacs heavily loaded with macros and color coded. Crazy! Why do that when there are so many good IDEs out there?
I have experience with using JCreator LE. I like it because it is easy to use and it is free. Give it a try if it interests you.

Good Java Practices in Ubuntu

Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser.
I've considered Eclipse, but it seems to bloated and unfriendly for quick programs.
Java editing tends to go one of two ways; people either stick with a simple editor and use a terminal to compile/run their programs, or they use a big IDE with a zillion features.
I usually go the simple route and just use a plain text editor and terminal, but there's still a lot to be said for IDEs. This is especially true when learning the language, since hitting "spam." brings up a dropdown with all of the fields and methods of the spam object. And this is not just useful to a beginner; it remains useful later on when using unfamiliar libraries and third party modules.
IDEs also have useful tools such as GUI builders which become invaluable when doing professional Java work. So although I typically prefer a simple editor/terminal combo, I highly recommend trying out an IDE such as Eclipse or Netbeans to see how you like it and so that you'll know how to use one later on.
Eclipse may be bloated for learning needs, but will probably give you the best overall Java experience. Try working through some of the built-in tutorials if you find the interface confusing.
I too vouch for eclipse (or IDEA if you have the money, actually IDEA is better than eclipse by a small margin).
But, make sure that you know how to compile and debug without an IDE first, and also learn to read the compiler's warning/error messages - they are essential skills for developers that using an IDE can prevent you from learning.
Eclipse and NetBeans are both good options. If you don't mind paying a little, so is IntelliJ IDEA (an academic license costs $99).
As far as IDEs go, I've found Eclipse to be about the best you could ask for. If you are used to IDEs full of features like VS, it should be right up your alley, and it isn't particularly resource-hungry; the way it organizes your projects makes the whole thing pretty simple as well, and it's also good to have on your resume. If you're looking for a non-intrusive IDE, mostly intuitive and that does its job as a great assistant, go with Eclipse. Not to mention its customization options.
If, on the other side, you'd like a much more light IDE, textPad-style (why?), I'd recommend Geany; I've worked with it in the past and it's got all the basic features to get started with the language and not be overwhelmed with all the features that big IDEs can offer. But I'd still recommend to go with Eclipse as soon as you get used to the language and need the IDE to be more of an assistant.
Another vote for Eclipse. In particular, you should be able to install it from within Ubuntu, as there are packages for it in one of the repositories (I forget which one specifically, as I'm not at my Ubuntu machine right this minute). If you use the GUI package-management application under the "Admin" menu, you should be able to find Eclipse and related packages.
I'd actually just recommend Eclipse. It seems bloated at first, but once you get used to it, you can use it to develop code very very quickly (and thus it's an excellent choice for a quick bit of Java).
Features I like:
Control+1 for error fixing - it knows how to fix most compile errors - just highlight the error in the code (which will be underlined in red) and it will give you a list of suggestions. Control+1 selects the first suggestion, which is almost always correct.
You can use this error fixing feature to write code that uses methods you haven't written yet - the error fixing will create the method on the class/interface you called it on, with the correct parameters/name/visibility etc. Or, if theres a similarly named method with similar parameters, it will suggest you've spelt it wrong when you called it.
The refactoring tools are also supergreat - you can highlight a block of code to extract as a method, and it'll work out what variables need to be passed in, and what it should return (if anything). You can move variables between field and methods. You can change class/interface/variable names, and it will correct them only where it needs to (which beats a search and replace any day).
You really don't need to know many eclipse features to get the benefit of using it - and it'll dramatically speed up your coding. I wish I'd known how to use it at University.
Basically, I'd recommend Eclipse. The time saved coding will make up for having to click "yes" a couple times when you start a project..
I'm using NetBeans with success right now.
I usually just use vim, but i've actually found the IDE Geany quite intuitive with a lot of good features but not really overblown. Check it out.
EDIT: I don't think Geany is fit for enterprise-level programming, but for a quick program it's one of the better IDEs I've seen, especially if you've had bad experiences with NetBeans or Eclipse as I have.
As many others, I suggest you to use Eclipse. It works fine in linux and after a few days you will find it not so unfriendly.
Moreover, if you will start developing more complex programs in java, you already will be familiar with a standard, complete and open source IDE, which is also the foundation for many other professional IDE for other languages, like Adobe Flex Builder, Aptana Red Rails and so on.
There is an interactive "IDE" designed especially for learning: BlueJ at http://www.bluej.org/
While I generally agree that Eclipse, NetBeans, or one of the other IDEs can be very helpful, they are pretty heavyweight for a learning environment; and you can end up spending your time wrestling with the IDE instead of learning Java.
In my career I've also found some people that don't really understand what the IDE is doing for them; they are totally lost without it (see Voodoo Programming). I recommend you spend at least some of your time with a simple editor, like gedit or vim, and the command line javac compiler.
BlueJ is considered a good editor for Java, tough mostly aimed at beginners. It does not bloated as Eclipse, but contains many useful features. It is also an open source project, so you are welcome to give it a try.
In our working enviroment we have to use the free Oracle JDeveloper ... sigh .. at home I tend to use Eclipse more and I really like it
Netbeans is a heavy but good IDE. Netbeans always have many features you don't really need, but because it's made with the netbeans platform, you can always strip it down to the essentials !
If you don't like all the work, go with eclipse. It's a lighter IDE.
Geany is pretty handy, don't quite know how it is with programming Java, but with programming C and C++ it's a nice light weight IDE. (BE WARNED: Building big projects usally tend to fail in geany. Workaround: compile in Geany build in terminal)
Bryan

Categories

Resources