Client Side Java - Don't use it
Java is supposed to be a standardized language that can be used to
develop complex applications.
I have seen several examples which prove this to be true.
However, my experience writing the equivalent of a 2 line version
of "Hello World" is that all the effort spent on Java development
is totally wasted.
The advertising slogan is
Write Once and Run Everywhere
Many web designers say
Write Once and Debug Everywhere
However, my experience is
Write Once and Throw It Away
(I am told that WordPefect spent millions developing a Java version.
Since it is not on the market, I assume that they had the same experience.)
Example 1
I used IBM's VisualAge Java development system to write a simple
program which uses the standard awt label object
to place text on the screen.
It compiled and ran perfectly in the provided JVM
(Java Virtual Machine, aka Java Interpreter).
- Under VisualAge, the text displayed perfectly.
An imbedded \n caused the expected line break.
The alignment attribute caused both lines of text
to be centered in their object.
- In IE 4.0, IE 4.47, IE 4,72, and IE 5.00,
the \n displayed as a vertical bar and
the text was rendered on a single line.
- In Netscape 3.02 Gold and Netscape Communicator 4.05,
none of the text showed
Java code and
example
(Displays nothing in Netscape 3.02 Gold and 2 of 3 labels in IE 4.72).
(I tried to import this back into Visual Age in order to simplify
it ... but it would not show the existing display objects.
Apparently, if code is modified by hand, you're screwed!)
Thus proving that adage - Write Once and Throw It Away
IBM's VisualAge placed the following code in the application
setLayout(null);
I have tried 3 reference books, and none of them even mentions
what a null layout might do.
Perhaps VisualAge should be strongly advoided for using un-documented
features.
Well, documented or not, the null layout is probably
the best layout because it gives the programmer the most control
over how the application will be displayed.
(Of course, one of the touted benifits of Java is that
the developer can only suggest how the application will
be displayed.
Give me a break.)
For more details, see
here.
Debug Problems
This one took most of a day to figure out.
When I write html code (using notepad, of course :),
I do a save (Alt f s), Alt-Tab to the browser, and refresh (F5 in IE)
to view the changes.
Therefore, I expected Java to work the same way.
Suprise ... refresh does not load the new class file.
Instead, you have to kill all instances of your browser
and restart it in order to read the new code.
What a load of ... .
I spent hours trying to find a way around this stupidity.
This nonsense was tested with both IE 4.0 and Netscape Communicator.
I hearby confirm that both products are brain dead!
Actually, Ctrl-F5 is supposed to re-load class files in IE 4.0
(I have verified this with IE 4.72).
Ctrl Shift R is supposed to cause Netscape to re-load everything
(I haven't verified this yet).
Notes
- Class names are case sensitive.
Every applet must contain a class definition with
the same name as the class file.
In the html file, the Java class file and the initial class
are identified with an applet tag
<applet code = "Name.class" ></applet>
Both the string after the code paramter and
the class name must
use the same case on a letter-by-letter basis.
(Guess how long this took to figure out.)
- The only way to write portable code is to use only Java 1.0
commands. If Java 1.1 commands are used, Netscape 3.x and IE 3.x
will report errors and not run your code.
Unfortunately, the Java 1.1 language and Visual J++ 6.0 report
many Java 1.0 commands as deprecated meaning that they will
eventually be dropped from the language.
The best guidance that I can give is to always use
deprecated commands and take your chances.
- codebase does not work with netscape communicator!
It generates class not found errors.
References
- This 1996
Tutorial is pretty good. It contains a very simple
"Hi Mom" applet which writes a single line of text to the screen.
If you really want to waste your time with Java, then start here.
- The Java Hall of Shame lists a number of problems with JDK 1.0.2.
Examples are provided.
- Sun Microsystems, Inc.
has a whole site devoted to Java.
They claim over 700,000 Java developers.
The technical section requires free registration.
However, I am not impressed with their site. It mostly talks about
how great Java is but does not say anything useful.
- microsoft.public.java.visualj++ news group.
This is where many otherwise undocumented hints are revealed -
such as using ^F5 to reload class files in IE 4.0.
- My Java Development page.
-
Major security hole
- MS Internet Explorer and HTML e-mail readers allow Java applets to
run ANY ActiveX component.
This hole allows full access to your system by anyone on the net.
(Reported by
zdnet with a
patch and additional info.)
Author: Robert Clemenzi -
clemenzi@cpcug.org