Typical Java applet structure
-
Java source Ñ> javac compiler Ñ> JavaVM universal machine code in .class file
-
Store JavaVM .class files on web server
-
Download JavaVM from server to client
-
Interpreter built into browser, which reads JavaVM and executes on client
|
Typical JavaScript structure
-
JavaScript source is embedded in HTML text
-
Combined JavaScript and HTML is downloaded and interpreted by client browser to produce HTML page
-
Particular user actions on HTML page (e.g., mouse clicks and form entries) can invoke JavaScript functions on the client
-
Browser must interpret raw, high-level language, which is substantially slower than interpreting JavaVM where interpreter maps universal machine code into machine code for a particular computer
|
Note in each case , Java and JavaScript use "runtime", which is "compiled, high-performance library" (probably written in C and C++)
|