Home
Site Map
[ Site Map ]
Java by Example

Setup: Getting your Tools ready

Next »


This page is supposed to guide you on your first steps with the Java tools. If you have not done so already, you should now download the Java Development Kit 1.02 (3,44 MB) and the Integrated Development Environment FreeJava (963 kB).

Feel free to use a newer version of Java if you like, but then you won't be able to compile my examples without modifications. I recommend beginners to stick to the JDK 1.02 for a start, if possible. The latest version of the Java SDK is always available from the SUN Java website.

If you want to use a more sophisticated IDE, I recommend NetBeans, which is by far the best free and open source Java IDE out there. It can also be used to write Java programs for mobile devices (Java Micro Edition) with the NetBeans Mobility Pack.

To browse the documentation of new Java versions in Windows Help format, go to this site.

I have packed the Java API documentation in WinHelp format into the zip archive of the JDK (subfolder "API Docs"), which will later come in handy. Once you have downloaded both files, you have to unpack (unzip) the JDK and copy it to your hard disk drive. Don't change the contents or structure of the folder! In the explorer it should now look like this:

Now install the "FreeJava" development environment to any folder you want on your hard disk drive and start the program. Next open the preferences menu:

...and enter the path to your Java SDK folder like this (enter the path to the "java" subfolder!):

Now open a new FreeJava project:

...and choose "Applet Project" as the project type. You may also choose the name of the main class of your applet now, the default is "MyApp". The name should be somewhat describing, for a tetris game it could be "Tetris" etc. For now, you can leave it at the default setting.

You must now specify a folder to save the new project in. If everything is set up correctly, FreeJava created a simple "Hello World" applet project for you, and you should now be able to see a window like this:

Now you can build (compile) the java file to a binary class file (the "run" button is also OK) ...

...and run the applet!

The result should look like this:

The applet is started with the Applet Viewer, which comes with the Java SDK. Later on, you will usually start the applets from within a html-page inside a web browser.

Congratulations! You have just created your first Java applet!

Next chapter »
Est.: March, 1999 - Last updated: September, 2006
© 1999-2010 Johannes Wallroth