Five Things You Should Know About Java

...but were afraid to ask!

Written by: Larry Coffey
Coffee

Who is this written for?

Everyone. Well, anyone who was curious enough to look here, anyway.

Perhaps you've heard the Java buzzword bandied about by technogeeks and cyberheads at the local café and Wi-Fi hotspot. You've figured out that they aren't talking about the overpriced brown sludge the over-caffeinated teenager is serving behind the counter. Your curiousity is piqued, so you searched online and wandered onto this site.

Well then, let me not delay you any further and hope that I can at least partially satiate your thirst for knowledge. And all at a price much less than that brewed aromatic bean...



Table of Contents



What Is Java?

Coding Nightmare

1

Java is a computer programming language. It is a modern, secure, general purpose language. It is designed such that a program written in Java can run unmodified on many different computer architectures, including Windows, Macintosh, and Linux. That portability is one of its strengths, and makes it ideal for web-based applications.

What Java is not, is something that goes by the unfortunate name of JavaScript – which is a completely different language. Originally named LiveScript, it was renamed to JavaScript by some marketing genius at Netscape who apparently wanted to purposely confuse the market. Let me emphatically clarify it here: JavaScript is completely unrelated to Java.

A computer program is very much like a detailed recipe, containing explicit step-by-step instructions that tells the computer exactly what to do. A computer language defines the rules ("syntax") on how that recipe is written. A programmer has many types of languages to choose from when creating a program, all with their own strengths and disadvantages. For more on this subject, visit Computer Programming.

So, if a program written in Java can run on almost any computer, then why aren't all programs written in Java? Simply put: because portability comes at a price, the most major of which is performance.

Most computer programs are translated from their "recipe language" down to a native language that the computer understands, something very close to ones and zeros, called machine language. This allows the program to take advantage of the extraordinary efforts that hardware engineers put into tweaking every last cycle out of their processors. Java does not do this.

Being portable, Java can't take full advantage of the local processor power or operating system enhancements, instead relying on an intermediate step that must be translated on-the-fly. This intermediate step is called bytecode; it's what a Java program is translated into instead of machine language. For a Java program to run on a computer, that computer must have a Java Runtime Environment installed to interpret a Java program's bytecode.



What Is A Java Runtime Environment?

Java Ticket

2

The Java Runtime Environment, also called the JRE, is installed on your computer to allow Java programs to run. It provides the software that interprets the Java bytecode to run properly on your computer.

Since Java runs on multiple computer architectures, it is not compiled into native machine code like other programs you run. Programs like Microsoft Word or Google Chrome run natively. That means that the same, exact executable file of Chrome, for example, written for Windows, would not run under Linux. While there may be versions of your favorite programs available for both operating systems, the programmers had to put extra effort (a lot of extra effort!) into the product to make two, three, or more versions.

Java programs are not like that, however. The same Java program file that runs on Windows, can also execute on Linux, or on a Macintosh, or on any system that has a Java Runtime Environment installed. And that's the key! The JRE takes that Java binary executable file and translates into something your computer can understand.

The JRE also contains other Java functionality that a program expects from the environment. These are called libraries. All major languages have standard libraries, and Java is no different. The Java libraries are installed with the JRE.



Is Java Secure?

Model in Chains

3

Java was the first major language designed with security designed into it. In fact, one version of Java programs – Java Applets – runs in what's called a sandbox to prevent the program from touching critical system resources, like your file system. An example of an Applet is the version checker in Section 5, below.

Unfortunately, like anything else, nothing is perfect. A Java Applet is deployed within a web browser, and therefore is only as secure as the browser itself. On the other hand, full-blown Java Applications – like all computer applications – have complete access to your system resources. Regrettably, this cannot be prevented. For example, could you imagine a word processing program that could not open or save document files? For that, a program needs access to your file system. As you should with any application, make sure it comes from a trusted source.

If a security issue were to occur, it would probably be more likely to happen during the deployment of an application rather than the execution of it. In fact, one such deployment technology was recently called into question: Java Web Start – a method of deploying full-blown applications (not Applets) from a website. This is not to be confused with a Java Applet, the most secure of the deployments due to its execution within the browser sandbox.

Note that some Java Applets may need access to resources outside of the sandbox. For that to occur, you have to give explicit permission for the Applet to run. When an Applet needs more security privileges the developer must register for a code signing certificate from a trusted company, like Thawte. In theory, this makes the Applet more trustworthy, but since it will now run outside of the sandbox, as always, make sure it comes from a trusted source.



Do I Need It?

Asteroid

4

Java is used nearly everywhere, from web applets, to blue-ray disc players, to some cars. You may already use it and not even know it.

Whether you wish to install the Java Runtime Environment on your computer or not is all up to you. However, without it you won't be able to run Applets or any program written in Java. And there are some pretty cool programs written in Java these days.

If you do opt to install it, make sure you keep it up to date. The Java Runtime Environment should prompt you when a new version becomes available.



Do I Already Have It? If So, What Version Do I Have?

Java Version

5

There's a simple test you can run to see if you've got it installed on your system already: Run this Java Test from our good friends at SillyTutu.

If Java is not installed, then you'll get a message like: Sorry, but Java™ is either not yet installed on your system or it has been disabled in your browser. If it is installed, then a Java Applet will run, displaying some information about the version of Java you're running.

SillyTutu is one of my many half-completed projects. Someday I'll get back to writing Java games.



Conclusion

Congratulations! You now carry a little more knowledge about the fascinating world of modern technology. Next time you hear some cybergeek blathering about Java, you can confidently say, "Dude, it's just a language. Get a life."

Have fun!



Appendix A - Installing Java

The latest version of the JRE is available from Oracle/Sun Microsystems at: Java Runtime Environment. Click on the Free Java Download button to download the Java installation program. Once it's downloaded, run it, and follow the on-screen instructions to install it.

Once it's installed, try the Java Runtime Test to verify that your browser is Java enabled.



Appendix B - Acronyms And Other Nonsense

IDE
Integrated Development Environment - used as a complete soup-to-nuts development platform that includes editor, compiler, linker (when appropriate), and debugger. Examples of IDE's include Microsoft Visual Studio, NetBeans, and Eclipse.
Java EE
Java Platform, Enterprise Edition - used to build Java applications that are typically server based. Additional libraries are provided to create fault-tolerant, distributed applications with modular components.
Java ME
Java Platform, Micro Edition - used to build Java applications that are typically executed on mobile phones or set-top boxes.
Java SE
Java Platform, Standard Edition - used to build Java applications for general use.
JavaFX
Scripting language that executes on top of Java.
JavaScript
Interpretted language used in many web browsers, mostly unrelated to the Java language, though it may be used in communicating between Java applets and the web page itself.
JDK
Java Development Kit - tools used to build Java applications.
JRE
Java Runtime Environment - the interpreter that runs in your browser.


Photo Credits:
Coffee by Scholastica Ees
Coding Nightmare by Leon Brocard
Java Ticket by Stephen Barnett
Model in Chains by Wineblat Eugene - Portraits
Asteroids by Theis Kofoed Hjorth
All others Copyright (c) 2010 SillyTutu.com, Inc.