Depending on what version of java you want, (2 or 5 - 5 being the VERY newest), you'll want one of the following:
java 1.4.2_05 (java2) here
Accept their license, and look under "Linux". They have two choices. The one you'll be wanting to download is the one that doesn't have the RPM in it ("self extracting file). It is a binary, and to install it you do the following:
chmod +x whatever_it's_name_is.bin
and follow the instructions. It is good to install it into the /usr/java/ folder, and it should have that set as the default.
To make the binaries work globally on your system, you'll need to make links to them (as root) - i'll use my system as an example:
# ln -sf /usr/java/j2sdk1.4.2_06/bin/java /usr/bin/
# ln -sf /usr/java/j2sdk1.4..2_06/bin/javac /usr/bin/
And do that for whatever other command in that folder you wish to use globally.
The other option would be to add the bin/ folder to your path. Add the following to the end of /etc/bashrc if you use bash:
And this will include ALL of the binaries in that folder for global usage.
To compile java programs you use the javac
command (you should know this already
) and to run them you use the java
As for editors, I prefer emacs, because it has nice coloring for the java language, and supports smart auto-indenting to line up my methods. It also supports rcs, compilation, and running of your programs.
As for netbeans IDE.... that is nice to use, but has some set-backs. It is designed for larger, more professional programming (i'm still a student, so professional programming doens't apply to me, though it might for you - i don't know). The problem i have with it is that if you simply want to make one-file java programs (not a whole bunch of other files in a long large tree), and you wish to create many different programs, then don't use it, because you need to "mount" filesystems (folders to use) in the IDE, because it likes packages (which is the tree of .java files in many subfolders). You'd have to include 'package blabla.blabla' in the top of the file for everything.
Plus it takes long to load and has so many options that it gets confusing. If you're in to all of that, by all means use it. Remember, this is just my opinion based on past experience.
For simplicity, I'd recommend you use a simple text editor, such as vi/vim, emacs, kwrite, pico, whatever
and compile them via the console. It's much faster and most simple.