Java by Example - getting your tools ready

setup 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 next

0 - setup - getting your tools ready
1 - basic graphics functions
2 - simple methods and basic data types
3 - IF, ELSE and SWITCH: basic control structures
4 - introducing the operators
5 - methods with and without a return value
6 - using methods and basic mouse functions
7 - fonts, random numbers and timers
8 - flicker free graphics, GIF and JPEG display
9 - animation with GIF pictures, sprite animation
10 - loops, advanced color functions
11 - random colors and arrays
12 - digital clocks, HTML page parameters
13 - introducing classes and objects
14 - using the Vector class
15 - using mouseMove and mouseDrag
16 - keyboard commands and playing sound
17 - detecting collisions and intersections
18 - a Bouncing Balls applet
19 - fun with letters and words
20 - rotating lines and polygons
21 - sorting and shuffling

This page is supposed to guide you on your first steps with the Java tools. All the tools used here are available for free and can be downloaded from my site www.programming.de . 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). To unzip the JDK, you can use FreeZip (292 kB).

You can download this tutorial in a zip-file here (313 kB).

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. Now 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!

You can now proceed to chapter one of my tutorial Java by Example


© 2000 by Johannes Wallroth
www.programming.de

watson@programming.de