See my Defensive Computing blog at Computerworld.com  

About This Web Site

When I was learning Java, it was annoying that there was no simple easy way to determine which version of Java was being used by a web browser. At the time Microsoft was distributing its own JVM. As they are no longer doing so, the issue expanded into whether Java is even installed at all. Thus, this web site.

This site does not address stand-alone Java programs that run outside the scope of a web browser and a web page. That's another story.  So too is the JDK (Java Developers Kit) which is only of interest to Java programmers.

 How The Java Version Display Applet Works

Java programs run under the control of a Java Virtual Machine. The JVM is aware of both its vendor and version. There is a Java function call (aka "method") that returns this information to a Java program. The pink box displayed in Method 1 is logically owned by a Java applet. That is, all the pixels in the pink box are displayed by a simple Java applet that I wrote. This applet gets the current JVM version and the name of the company that created the JVM and displays it. The full source code of this applet is shown below. 

 import java.applet.*;
 import java.awt.*;
 public class JavaVersionDisplayApplet extends Applet
 { private Label m_labVersionVendor; 
   public JavaVersionDisplayApplet() //constructor
   { Color colFrameBackground = Color.pink;
     this.setBackground(colFrameBackground);
     m_labVersionVendor = new Label (" Java Version: " +
                                    System.getProperty("java.version")+
                           " from "+System.getProperty("java.vendor"));
     this.add(m_labVersionVendor);
   }
 }

NOTE: Web developers using Front Page may find that IE uses different versions of Java at different times. That is, a standalone version of IE may use Sun's version of Java while a web page displayed using Front Page's Preview feature may use Microsoft's Java. 

NOTE: A few people have re-compiled the source code above and found that it no longer works the same. When compiled with a 2005 version of Java from Sun (and maybe 2004 too) it chokes on copies of IE with the Microsoft JVM. One reader of this site said the following compile options fixed this problem: 
       javac -O -target 1.1 -source 1.2 javafilename

For more on this see Java Troubleshooting by Brian Cryer who says the problem may be a mismatch between the version of Java the applet was created with and the version on the users machine. He suggests compiling with: 
         Javac xxxx.java -target 1.1
Where 1.1 is the release of the Java VM you wish the .class file to work on. 
  

 Techie Stuff About the Site

In June 2007 the site was made printer friendly. That is, each page automatically gets modified to a printer friendly format when it's printed. Thanks to CSS.

Stats: In February 2004, I added page counters and site-wide statistics that I programmed in PHP. Initially the script and counter files lived on my personal site (and were included using IFRAMEs) because this site had low bandwidth and no PHP support. In January 2006, everything was moved to this site and the stats display was neatened up a bit. That the stats start in 2008 was due to some problem in either moving the site or the installation of a new version of PHP (I forget).
Between February 20, 2004 and March 23, 2004 this site averaged 942 page views (not hits) per day. By January 2006 the average page views/day was about 1,900 (cumulative from early 2004).

Outages! Towards the end of 2005, this site was consistently going off-line at the end of each month due to its having exceeding the monthly bandwidth allowance. In December 2005 the site was moved to another hosting company with a higher bandwidth allowance. But, the site grew in popularity. Starting in the summer of 2009, the same thing started happening again. I let this fester until July 2010 when I signed up for a higher bandwidth allowance.


 Author

Michael Horowitz conceived, created and maintains this web site. I am a computer consultant and write a Defensive Computing blog at Computerworld.com and tweet as @defensivecomput.

Some articles I've written: