Java is a very commonly used programming language on the web. It
was created by Sun Microsystems.
It is a compiled language, which means that it must be translated (ie. Compiled) into machine code before use. However is the beauty of Java is that the code is converted into machine code for a virtual machine (your browser) not a specific computer or operating system
Its big advantage is that it will run on almost any system
In terms of the web Java is coded in to programs called Applets, which can be triggered easily from the HTML page. Your browser will do all the hard work of setting up and running it (note most need a browser of the level of IE3 or Netscape 2 or higher to operate)
Applets are good for complex activities (you can even buy a word processor package written in Java and that it takes up little in terms of your page space. However once triggered the applet needs to separately download often with a slight delay
Applets are stored in .class files
Most applets allow you to customize their function or parameters (e.g. change text or link targets). Although applet writing is beyond this tutorial. Setting up applets isn't difficult
Let's use an example created by Sun
The source. (Click for copyright and precise Java info)
There are 2 ways to add the applet
The first is to use the insert a Java Applet option menu (Insert -> other component-> Java applet)
In (A) Applet source enter the name of your .class file. If this outwith your web folder (e.g. on someone else's site) enter the (B) base URL. Then put in a message for non Java browsers. Set any (C) parameter values (a helpfile with applets usually explains these or in HTML they are defined in <param> tags. Set the window width and heigh (D) & (E)
The second is with HTML The applet is coded for by these 3 lines
<applet code="NervousText.class" width=375 height=50>
<param name=text value="Leaping text !!!!">
Sorry you need a Java enabled browser to see this
Theses are explained in our HTML section
Writing Java and applets is beyond this site
However, there are tons of free applets on the net just like images. . Check the links section for some ideas. Remember to check the copyright of any you use. Many are downloadable but some your site links to and access (so you don't include the .class file on your site - your site links to a site acting as a server for the applet). Most have a way of giving the HTML directly to you so all you have to do is place it in your documents. And it is a relatively simple programming language.
There are plenty of sources of info on writing Java in print and online.
Check out our links
BACK TO ADVANCED TUTORIAL INDEX