This refers to doing it on Windows XP – Vista is probably very similar.
Java is a programming language, but it’s also something called a virtual machine. The way it works is you write code – source code – in text files, typically ending in .java. Then you compile them, using a java compiler. There’s a command line java compiler called javac, included in the JDK. When you’ve compiled the programs, they don’t become Windows executable programs – “.exe files” – but compiled java class files, files called .class. These you can run, but to do that you need a java runtime environment, a “JRE”. Most likely you already have a bunch of Java runtimes on your computer.
The Java Development Kit – JDK – contains what you need to compile java source code files to class files, and comes with a java runtime to run them. The JDK does not come with an editor, but you can those for free elsewhere. One really good is eclipse (www.eclipse.org). Another good tool for building Java files (and other stuff) is something called Ant (ant.apache.org).
1. Download the JDK
The version to get now is the Java (TM) Development Kit 6 Update 3. SE is Standard Edition. JDK is Java Development Kit.
Get it from http://java.sun.com/javase/downloads/index.jsp
The file I downloaded was called jdk-6u3-windows-i586-p.exe
2. Install it
Just run the installer. I usually try to avoid installing anything to programming in folders with spaces in the names – such as “Program Files”. That’s why I install Java to c:\sdk\jdk rather than the default C:\Program Files\Java\jdk.1.6.0_03. But that’s just my way of doing it
3. Set up your enviroment variables
This is perhaps not strictly necessary, but it’s how I do it. The easiest way to reach these settings is right-clicking on the “My Computer” icon, select Properties, go to the Advanced tab, and click the Environment Variables button.
JAVA_HOME should point at the folder where you installed it, e.g. c:\sdk\java
Add %JAVA_HOME%\bin to your path.
Open a new command window (so the environment variables setting are valid).
Typing java -version and javac -version will tell you what version you’ve installed. If it fails, something’s wrong wity your setup.
Note that if your uninstalling the JDK, better use the Control panel add/remove programs option, don’t just delete the folder.
Addons for Java – API:s – are usually distributed as zip files. In the zip file you’ll typically find documentation, readme files, license descriptions etc, sometimes the source code, and also the actual jar files that contain the compiled classes.
Some people will copy the jar files to their jdk/lib folder, others will put them in a lib folder under the project they’re working on. The way I do it is usually to unzip the entire archive in a folder, c:\sdk\api, so I have a bit more overview of what versions they are etc.