|
|
Applets:
One of the first things I noticed when I started using Java was that even though it’s intended
to be a cross platform environment it seems like some providers of internet browsers haven’t
adhered to the Java standard. The key result I see, in many cases, is
I need to provide alternate sets of program code in a given web page to work with the different
browser brands. In addition as I’m just starting with Java and I want to code with the most
current version; Java 1.2 has just been released. Most of the browsers in the world fall into
one of three categories now. Some don’t support Java at all, some support Java 1.0, and some
support Java 1.1. Since I am writing applets for fun I don’t have anyone telling me what they
have to be compatible with or what percentage of users must be able to use my applets. I have
chosen, therefore, to write applets that conform to the standard at revision 1.2. The good news is
that there is a nice answer to these problems and most people will be able to run my applets if
they want to. Sun Microsystems provides, at their web site, a Java plug-in. This plug-in is
available for down load and installation; sure there are some license terms. Individuals can go
to the Sun web site and get the plug-in or you can set up your HTML tags such that if they don’t
have the plug in they are offered the chance to get it. I know some people have been turned off
from down loading plug-ins because in some cases it leads to a path where the company wants you
to buy something. That doesn’t seem to be the case with Sun Java stuff. This is really great for
someone writing Java because it means your users who have the plug-in will be able to run your
Java code and you don’t have to write a bunch of alternative code or code to old versions. The
users gets the ability to run the latest Java and take advantage of the new functionality those
who code applets can provide with the latest goodies. Sun has even provided suggested HTML tags
to use this down load feature. I have followed their suggestion so a quick way to see it is to
do a "View Source" from your browser menu when you’re trying out one of my Java toys.
There were/are lots of rumors around about whether Java is "safe" or secure. People are concerned
about if a Java applet (or JavaScript) can do bad things to their computer, to their files, or
enable someone to find out things about them they don’t want others to know. I had all these
concerns too. Well, nothings perfect and early versions of Java had some security concerns associated
with them. You can read about the security issues at Sun’s Java web site. For myself I’ve concluded
that Java is safe for me to use. Java code runs in something called the Java Runtime Environment
(JRE). JREs can be available to run Java programs a couple ways. The way we care about for applets
or JavaScript is that the web browser provides the JRE or the Java plug-in provides the JRE. The JRE
is where security is enforced. Within a the browser's JRE is something called the sandbox. All
"Untrusted" applets run in the sandbox. Applets running in the sandbox don’t get to access memory
outside the sandbox nor are they allowed access to the computer’s drive(s). They have access to the
screen, mouse, and keyboard. Beyond that, they can access files on the server they came from, and a
limited set of system parameters on the users computer. These are enumerated in the tutorial at Sun’s
Java web site. To be trusted and gain access to other parts of your computer the applet must be signed
with a verified digital key much like the keys that are used to sign documents. Here the point isn’t
so much encrypting the applet to keep it secret, but more being able to verify where the applet came
from.
Up above I introduced yet another new term "JavaScrpit". JavaScript is much like a Java applet in that
it runs in a web browser’s JRE (Java Runtime Environment) or the plug-in's JRE. A JavaScript is Java
program code, maybe as little as a single line, that is written directly in the web page either embedded
inside tags like an anchor tag or between script tags. An applet is written in an editor outside the web
browser and saved as a text source code file (something.java) The source file is compiled into a ready
to run form, saved as a file (something.class), and the file is referenced in a web page in a special
set of tags. I don’t bother to mention the tags because they are one of the things that change between
web brower brands. You can get an idea of how that’s handled if you do a "View Source" from your browser
menu went you’re trying out one of my Java toys.
Go to my:
Java Toys
The links at the bottom of your screen will take you to the main topic areas