Note: This documentation is for Moodle 2.7. For up-to-date documentation see Java.

Java

From MoodleDocs

Java is a programming language made available by Sun Microsystems under the GNU General Public License. It is one of the object-oriented programming languages.

Java can run on any supported hardware/operating-system platform without having to be re-written. Sun's slogan was "Write once, run anywhere" (WORA).

Tips and Tricks

  • It is possible to insert a Java script by using the HTML editor. It is important to remember that the HTML editor does not use a header (a specific type of code at the very start of the page). A good practice is to use the WYSIWYG screen to create the desired HTML page, then switch to "view the source" with the <> icon. Now place the header information at the top and insert any other java scripts in the body of the page. Save the page.
    • TIP: When trying to edit the page again, the HTML editor may essentially disable the header information. Check the source code to restore the proper header on the page.


Java & Javascript

Java and Javascript are different things and not the same.

Javascript is a fairly simple scripting language, developed years ago by Netscape, and supported natively by virtually all web browsers. You can insert Javascript directly into HTML; no plug-ins or external applications are required for it to work, so long as Javascript support is enabled in the user's browser (and it usually is).

Java is a programming language developed by Sun microsystems. You can't insert Java directly into HTML. A Java Applet, which has been programmed using the Java language and compiled externally, can be embedded in a web page (like a video or Flash object), but whether it works or not depends on the end-user having an external Java client installed on his/her computer.

Some web sites also use Java server applications, but that's yet another animal.

Javascript is what makes "dynamic html" effects possible (drop menus, etc.)

Java applets on the web are more like miniature applications -- such as image editors, or of interactive media. In this way, it's again similar to Flash or Shockwave multimedia objects.

See also

Flash