Java by Example - getting your tools ready
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 |