Welcome to RoadDust's Java tutorial. I will begin by telling you that Java is a great programming language. It is for many reasons, but mainly because there is no cost associated to it. You need absolutely no license to use Java. And as if this wasn't enough to convince you that Java is the language of choice, allow me to introduce you to one of the most amazing features of Java... The java applet. As it is now at the moment of this writing, one would have to download a java runtime environment to see your java applets. To many web masters having their clients download a program to view their page is unacceptable. However, soon Java technology will come with windows Internet explorer opening the doors for the Java Applet revolution. That's right! You can have a full blown application running directly on your webpage.
Installing JCreator instructions.
How to install JCreator on your computer.
Before installing JCreator, you must first install the Java 2 SDK. You can download it from Sun's Java Website. You may want to download one of the newer versions. To install it just click on the Open option of the download window. Once the installation is done, you will be ready to install JCreator.
Java and Java Applets basics tutorial.
Downloading the free Java compiler.
Before we begin this Java and Java Applets basics tutorial, you must download the Java compiler. This
compiler is called JCreator. The compiler is what will turn your code into executable code. It will produce
an executable file (.exe) that your computer can run. To download JCreator simply click on the link bellow.
Java basics, the Java hello world code.
Create the Java hello world application.
As tradition would have it, your first Java application should display "Hello World.". The installation of
JCreator should have created an icon on your desktop. Double click this Icon to start JCreator. If you get a
tip of the day pop up just close it. You must now create a new project. To create a new Java project, do the following.
A window will pop up asking you for a name, this will be the name of your project. You will also be shown the default path for your project. I suggest that you leave those as they are but feel free to take note of them as it is a very good practice to know where your code is stored. Pick a name for your project, write it in the box then click "next". You will now get a new screen with JDK profiles and required libraries. For the time being, donít worry about these things and simply click "next". You will then get a window saying select tool type, the "Compiler" tool should be selected, click "Finish".
You must now look to the left of the screen, there should be a window there called "File View". In this window you can see the folders that are contained within your project. You should have two folders, "classes" and "src". In the classes folder you will find a filed called the name of your project ".htm". If you open it you will see that it contains a basic HTML webpage with the applet tag needed to run your applet. You will later be able to paste the "APPLET" tag directly onto your webpage. However, what interests us now is what is in the "src" folder. In this folder you will find a file named the same thing you named your project with the ".java" extension. Open this file and you will find the source code for the Java applet.
In the above Java Applet code you will see two main functions. The "init" and the "paint" functions. The init function is where you will put most of your Java Applet source code. However, at the moment, the only line of code is in the "paint" function. The paint function is in charge of the graphic display. For now, in order to complete this Java hello world code tutorial, just change the line that says "Welcome to Java!!" to "Hello World!!". Now you can compile your project by pressing "F7" or one of the blue arrows up top. After the compilation process, press "F5" or the blue play button arrow on top to execute your Java Applet hello world application.
JCreator error on compile, cant find Java lang file.
Why won't JCreator work. Why can't JCreator find the java language file?
At this point it can be frustrating if you just followed the above example and got an error message. It may say that the java lang file cannot be found. I got a message of that sort, to get rid of it and get JCreator to work, I uninstalled my old version of the Java SDK along with the current one. I then reinstalled the right version of the Java SDK. After that, perhaps I am just paranoid, I reinstalled JCreator. This fixed the problem with JCreator not finding the Java language file.
Congratulations! You have successfully built the Hello World Java Applet.
The Hello world Java Applet is just the beginning. Learn more Java!
If you have JCreator, and just successfully built the Hello World application, you are ready to take on more Java tutorials. You can find much more Java information on this website. Go ahead and snoop around.