|
|
Here are some questions which can help you to understand better what is Java and how to use Java in your web pages. If you have any question you can email me.
1) What is Java ?
2) What are Java applets ?
3) What is needed to run Java applets ?
4) How to include applets in my Web pages ?
5) How to write my own Java programs or applets ?
6) How to run Java stand-alone application on my computer ?
7) What are the links between Java versions and the web browsers compatibility ?
8) Can applets be dangerous ?
Q) What is Java ? R)
Java was created by Sun Microsystems.
Java is similar to C++ but it is easier to learn, and its puropose is to be a mutil-platform language, that is to say we write a Java program once, we compile it once and the Java classes made with the "javac" compiler (with a ".class" extension) can be runned everywhere (for instance under Windows, Unix...). To do this the Java compilers don't compile the Java code completely, they produce "bytecode" which is interpreted by a "Java Virtual Machine" which is different for each system.
Q) What are Java applets ? R)
Applets are composants you add to your web pages. Because they are
written in a programmation language they are more powerful than scripts like Visual Basic
Script or Java Script. Applets are written in Java, an universal language which allow you
to use applets on any web browser that includes a java interpreter. It's the case for most
of the actual browsers (like Internet Explorer, Netscape Navigator...) With Java
Programming Security is maximum. Indeed applets can't read or write on your hard disk or
on the web server it stays. Applets can only read images and sounds.
Q) What is needed to run Java applets ? R)
To run Java applets on your computer you just need a web browser
which is Java compatible (like Internet Explorer 3.0 or higher, Netscape Navigator 2.0 or
higher). Then just open the page which contains the applet. If you don't see any
applets make sure that the option "Java enabled", or something like that is
activated in the browser preferences.
Q) How to include applets in my Web pages ? R)
Applets can easily be included in Web pages in the HTML code. To do
this you have to use the <APPLET> tag. Here is an example:
<applet
code="ButtonLink.class" width="200" height="150">
<param name = "lien1" value =
"http://www.yahoo.com">
<param name = "lien2" value =
"http://www.hotbot.com">
</applet>
After the "code" attribute you put the applet name,
and "width" and "height" set the applet size in pixels, on the page.
The "param" atribute is used to pass parameters to the applet, these parameters
are often used since they allow you to configure easily applets without changing
programmation code. "param" is followed by the parameter name, after
"name", and by the associated value, after "value". Another attribute,
"codebase", allow you to specify the directory path where the applet stands, if
it is not in the same directory as the HTML file is. There are other attributes, but less
used.
Q) How to write my own Java programs or applets ? R)
To make Java programs you need the Java Developpement Kit (JDK)
freely distributed by Sun. There are many versions, one per OS. Once installed, you find
in the JDK a Java compiler ("Javac") which compiles the ".java"
files written with a basic text editor, and an interpreter ("Java") which
executes the ".class" Java classes created by the compiler. You also find an
"appletviewer" to run applets without a web browser. You can download the last JDK for Windows
95/98/2000 here. You
can find other information here to install the JDK under Windows.
Q) How to run Java stand-alone application on my computer ? R)
To execute applets you need a web browser or an
"appletviewer" (like the one in the JDK), but to run Java stand-alone
application you need a Java Virtual Machine installed on your system. Windows 95 et 98
(except the first versions of Windows 95) have a Java Virtual Machine for Java 1.1. If you
want to run Java 1.2 programs (the last major version) you need the Java Runtime
Environnement (JRE) for windows (about 20 Mo once installed). You can download the last JRE on
the sun site.
Q) What are the links between Java versions and the web browsers compatibility ? R)
The Java language has 3 major versions : 1.0.2, 1.1, and 1.2.
Applets are usually programmed in 1.0.2, or in 1.1, because the web browsers don't support
the 1.2 version. 1.0.2 version is supported since Netscape 3.0 and Internet Explorer 3.0,
1.1 version is supported since Netscape 4.0 and Internet Explorer 4.0.
Q) Can applets be dangerous ? R)
No, because security has been and is a priority in the Java
conception. applets could be dangerous, and that's why they have
restrictions. One, they are not allowed to read or write on the local computer, and second
they can't connect to a remote host, they can only connect to the local server.
Copyright ©1999, 2005 TaijiSoftware
- http://www.taijisoftware.com
This site is optimized for Internet Explorer 4+, Netscape 4+, Firefox 1.0+
800x600+
|
|