There are so many myths about Java. This month, I'll look at some of the more persistent ones, and try to dispel any doubt.
Applets can read your hard-drive, and delete files
Any attempt by an applet to access local files will throw a SecurityException. If uncaught, the applet will crash, but no file access will occur.
The only exception to this rule is for digitally signed applets, which may be granted additional privileges. Your browser will display a dialog box, asking you if you want to accept the identity of the applet author. Choose no if unsure, and you'll always be safe.
Java requires a web browser. Java only runs in a web browser.
Java code comes in many forms. The most familiar to users is the applet, which runs inside a web browser. However, this is only the tip of the iceberg.
Java applications can be run just like normal programs. By installing a JVM from vendors like Sun or Microsoft, you gain the ability to run Java programs. It's just like normal programs, such as Microsoft Word.
Java servlets run inside a web server. Servlets are a replacement for CGI scripts, and Active Server Pages (ASP). Servlets are actually really fast, and can be more efficient than CGI scripts.
Java is a hundred times slower than C, so you shouldn't ever use it for "serious" programming.
The original Java Virtual Machines were slow, so slow that a comparable C application was about twenty times faster. The gap between C/C++ and Java is growing smaller though, thanks to better designed JVMs, and Just-In-Time (JIT) compilers that convert bytecode to native machine code at runtime.
Much of the cause for speed concerns is actually over applet loading - large applets take a long time to load initially. Thankfully, Java applications and servlets are not subject to such slow loading times.
There's no point learning any language other than Java - it will dominate the software industry and put C++ programmers out of work.
There are many languages suited to very narrow and specific tasks (such as artificial intelligence) that Java will never overcome. While it is true that Java has had phenomenal growth, and significantly eroded the role of C++, it still has a long way to go. Java excels in portability and Internet support - but C++ still offers better performance and the ability to interact with the operating system.
Applets are inherently unreliable. The differences between Netscape and Internet Explorer make it impossible to write stable applets.
The problems with the behavior of applets running under browsers is due to the different JVMs - between browsers and browser versions. These differences can be frustrating for developers and users. There are often workarounds though, and applets should always be tested with a variety of browsers.
The optimal solution is to use a single JVM, which will be used across all browsers. Sound like fantasy? Sun Microsystems, the creators of Java, have come up with the Java Plug-in. The Java Plug-in bypasses the browser's JVM, and uses its own. This means that users with the plug-in installed can always rely on uniform performance, regardless of which browser they use. For more information, see the java plugin.
Java actually holds a lot more potential than many people realize. It's more than just applets - Java software can run inside a web server, or standalone. However, Java isn't the only programming language around, and it's wise to learn at least the basics of a language like C++, Visual Basic, or Delphi. Java applets are secure, and won't delete your hard drive. And if you find that applets aren't working properly in one browser but do in another, consider using the java plugin.